Create Detail View

Hello everyone,

I'm trying to create a Detail View that will change according to the parent position. I know it's not possible to have it in a template and then redefine it.

I also created a Detail View with a Journal, but sometimes a "non existing object" message will pop-up.

Can you help me with a more generic code?

Thanks.

I stumble upon a source code, it's in C and I'm developing my API in VB, but that's not the issue.

I start my code using the source code as base, but I can't manage to get the tags for the center point of the Cirlce Detail View, this is what I got so far.


Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = s.ListingWindow
Dim dp As Part = s.Parts.Display
Dim wp As Part = s.Parts.Work

' Establece el dibujo ** drawing tag **
Dim drawing_tag As NXOpen.Tag
ufs.Draw.AskCurrentDrawing(drawing_tag)

' Variables para vista ** vista tag nula **
Dim vista_tag As NXOpen.Tag = NXOpen.Tag.Null
Dim vista_nom As String

' Variable para hoja actual ** sin tag **
Dim laSheet As DrawingSheet = wp.DrawingSheets.CurrentDrawingSheet

' Ciclo para sacar el tag de la vista en base a nombre ** vista_tag **
For Each vista As DraftingView In laSheet.SheetDraftingViews
If vista.Name.Contains("TOP") Then
vista_nom = vista.Name
ufs.Obj.CycleByName(vista_nom, vista_tag)
End If
Next

' Establece el anillo o parte ** anillo_tag **
Dim anillo_nom As String
Dim anillo_tag As NXOpen.Tag = NXOpen.Tag.Null
Dim anillo As Part = CType(s.Parts.FindObject("MAQ-100-20-00_base10"), Part)
anillo_nom = anillo.Name
ufs.Obj.CycleByName(anillo_nom, anillo_tag)

Here is the link to the C example.

http://www.viewmold.com/ug_html_files/ugopen_doc/uf_draw/uf_draw_eg45.c

Can someone please help me getting the center point tag.
Thanks

Automative

What version of NX are you using?

I'm unclear on what you mean by "change according to parent position", can you explain this more?

Have you tried recording a journal while placing a detail view?

Thanks for answering.

I'm using NX 8.5

I need to set the detail view to the center of an sketch, this sketch it's part of a ring-form component. The sketch's position, but not its size, may vary according to the ring diameter.

I already tried recording a journal, the reference of the detail view changes perfectly, but the size of it gets bigger or smaller, according to the change. I don't want this to change, I just want to change the reference's position according to the sketch (which always have the same name.

Thanks

Automative

I recorded a journal while creating a circular detail view. I chose an associative point for the center of the view and an arbitrary point on the drawing for the boundary point. As the model updated, the center of the view changed, but the boundary point remained the same causing the view circle to grow or shrink. To eliminate this behavior, I created a point that was offset from the view center point. Now as the model updates, the boundary point remains the same distance from the view center which keeps the detail view circle a constant size.




Below is the relevant portion of the journal code, the recorded values have been commented out so you can see what was changed. In my journal the center point of the view is "point5".





'&&& Build Boundary Point 2
'create offset point from detail view center point
Dim myVector As New Vector3d(1, 0, 0)
Dim myDirection As Direction = workPart.Directions.CreateDirection(point5, myVector)
'change this value to the size detail view that you desire
Const detailViewRadius As Double = 1.25
Dim myDistance As Scalar = workPart.Scalars.CreateScalar(detailViewRadius, Scalar.DimensionalityType.Length, SmartObject.UpdateOption.AfterModeling)
Dim myOffset As Offset = workPart.Offsets.CreateOffset(myDirection, myDistance, SmartObject.UpdateOption.AfterModeling)
Dim myPoint As Point = workPart.Points.CreatePoint(myOffset, point5, SmartObject.UpdateOption.AfterModeling)

'Dim expression3 As Expression
'expression3 = workPart.Expressions.CreateSystemExpressionWithUnits("p302_x=15.1267124535494", unit1)

'Dim scalar1 As Scalar
'scalar1 = workPart.Scalars.CreateScalarExpression(expression3, Scalar.DimensionalityType.None, SmartObject.UpdateOption.AfterModeling)

'Dim expression4 As Expression
'expression4 = workPart.Expressions.CreateSystemExpressionWithUnits("p303_y=11.7841903801911", unit1)

'Dim scalar2 As Scalar
'scalar2 = workPart.Scalars.CreateScalarExpression(expression4, Scalar.DimensionalityType.None, SmartObject.UpdateOption.AfterModeling)

'Dim expression5 As Expression
'expression5 = workPart.Expressions.CreateSystemExpressionWithUnits("p304_z=0", unit1)

'Dim scalar3 As Scalar
'scalar3 = workPart.Scalars.CreateScalarExpression(expression5, Scalar.DimensionalityType.None, SmartObject.UpdateOption.AfterModeling)

'Dim point7 As Point
'point7 = workPart.Points.CreatePoint(scalar1, scalar2, scalar3, SmartObject.UpdateOption.AfterModeling)

'detailViewBuilder1.BoundaryPoint2 = point7

'use the offset point for the boundary
detailViewBuilder1.BoundaryPoint2 = myPoint
'&&& End of Build Boundary Point 2

Thanks for the tip, code and answering.

I'll give it a try.

Automative