- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The AddLinear method requires a GeometryIntent object created from the Sheet class, and Sheet.CreateGeometryIntent() can only accept edges within the view. How can I convert an edge in the model into an edge within the view?
Or, my approach might be incorrect. What are the correct steps to achieve my requirement?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I really appreciate your help, it was a huge relief. I sincerely hope to have the opportunity to seek your advice again in the future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In the parts, you can manually assign a name to a certain face or edge, which will be displayed in "Named Geometric Elements". Suppose I name a face "Face 1" and name an edge within "Face 1" as "Edge 1".
Is there a method in the API that allows direct access to "Edge 1"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
You can use Attributes API, or iLogic.
If you want to use iLogic, you need to convert variable part to ICadDocument. Below is the sample how to do it.
This code can replace line 3 and 7 in above sample.
...
Dim part As PartDocument = drw.ReferencedDocuments(1)
Dim partCadDoc = New CadDoc(part)
Dim partEdge = partCadDoc.NamedEntities.TryGetEntity("Edge1")
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Are there alternatives to these methods in the Inventor API?
I noticed that there is no NamedEntities object in the Inventor API. How can I achieve the same effect using the Inventor API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This information is stored in Attributes. Try to look at this part of the API. You need to know how it works.
For better understanding and testing you can use NiftyAttributes by Brian Ekkins.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report