Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Michael.Navara
in reply to: 1210550275

This is a sample, how to create drawing dimension to the specified edge in model. It requires update, because it doesn't contain your logic for edge selection, text positioning, works only for part, etc. But it can be used as starting point.

 

Expected dataset:

  • Drawing with single drawing view on active sheet
  • Drawing view references simple part with one extrusion of box

 

'Get relevant documents
dim drw as DrawingDocument = ThisDoc.Document
dim part As PartDocument = drw.ReferencedDocuments(1)

'Get edge in model
' !! This is just a sample. Modify it for your needs. !!
Dim partEdge = part.ComponentDefinition.Features.ExtrudeFeatures(1).EndFaces(1).Edges(1)

'Get drawing sheet and view
Dim drwSheet as Sheet = drw.ActiveSheet
Dim drwView as DrawingView = drwSheet.DrawingViews(1)

'Get drawing curve which corresponds with model edge
Dim edgeCurves As DrawingCurvesEnumerator = drwView.DrawingCurves(partEdge)
If edgeCurves.Count = 0 Then
    Logger.Error("There is no drawing curve for specified edge.")
    return
End If

'Create geometry intent for edge
Dim partEdgeIntent As GeometryIntent = drwSheet.CreateGeometryIntent(edgeCurves(1))

'Crete dimension
Dim textOrigin As Point2d = drwView.Position
drwSheet.DrawingDimensions.GeneralDimensions.AddLinear(textOrigin, partEdgeIntent, DimensionType := DimensionTypeEnum.kAlignedDimensionType)

 

 

Dataset preview

 

2024-11-13_10-19-14.jpg