I am trying to automate the placement of sketch symbols in my drawings which I use for labeling images and .dxf export.
My issue at the moment is that placing the sketch symbols is rather long and tedious. see circled E's
What I would like to do is something along these lines:
Change the appearance of the faces which need the 'E' symbols.
Use some sort of ilogic code to auto place the symbols on/near the edges of the corresponding face.
Is this a realistic project to undertake? Is there already some sort of feature could be using which would work for this application?
Thanks,
Solved! Go to Solution.
Solved by WCrihfield. Go to Solution.
Hi @sbulowPFMJG. It sounds possible to automate, but if you have Inventor 2019 or newer, it would most likely be more efficient to assign names to the faces or edges that you want to focus on. In the part modeling environment (not in the assembly envoronment), you can select a Face, Edge, or Vertex, then right-click and choose 'Assign Name', to assign a name to the geometry. When you do that, you can find that named geometry within your iLogic rule code, by accessing the NamedEntities (Link) interface object, and its methods.
Wesley Crihfield
(Not an Autodesk Employee)
k, I just gave it a try on one of my models. I'm not so sure I'll be saving time in the end. i have models with 50+ faces to ID. Its kind of long going and selecting each face individually and assigning unique names to them. I'm leaning towards the 'appearance' because I can group select faces and it can be done very fast in the 3D environment.
OK. So are you are planning on assigning a single appearance to several faces, all at one time, then you will want to find all of those faces by code, by which appearance they are set to, right? If so, I totally understand that. There are often multiple ways of doing things in Autodesk software. So, are you exporting the drawing document directly as a DXF then? When you find a face, you can supply that Face as input to the DrawingView.DrawingCurves property to get a DrawingCurvesEnumerator containing the geometry within the view that represents that face. It will contain DrawingCurve objects, but you may also want to loop through the DrawingCurveSegments of each DrawingCurve to get the line to place the symbol on.
Wesley Crihfield
(Not an Autodesk Employee)
Yes, This is what I was looking for. Thanks!!! This will be a great starting point for me.
Hi @sbulowPFMJG. Glad to know I was on the right track. In the mean time, I threw a little something together for you, as somewhat of a kick starter for your code. Within it, I am simply attempting to find an appearance named "Red" within the document's local appearances, so if that doesn't match your scenario, you will have to edit that part a bit. I am only going as far as the geometry intent part though. The rest is up to you for now.
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("A Drawing document must be active for this code to work. Exiting.", vbCritical, "")
Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDDoc.ActiveSheet
Dim oView As DrawingView = oSheet.DrawingViews.Item(1)
Dim oModel As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument
If oModel.DocumentType <> DocumentTypeEnum.kPartDocumentObject Then Exit Sub
Dim oPDoc As PartDocument = oModel
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oBody As SurfaceBody = oPDef.SurfaceBodies.Item(1)
Dim oRedFaces As New List(Of Face)
Dim oRed As Asset = oPDoc.AppearanceAssets.Item("Red")
For Each oFace As Face In oBody.Faces
If oFace.Appearance Is oRed Then
oRedFaces.Add(oFace)
End If
Next
If oRedFaces.Count = 0 Then Exit Sub
Dim oGeomIntents As New List(Of GeometryIntent)
For Each oRedFace In oRedFaces
Try
Dim oCurves As DrawingCurvesEnumerator = oView.DrawingCurves(oRedFace)
If IsNothing(oCurves) OrElse oCurves.Count = 0 Then Continue For
For Each oCurve As DrawingCurve In oCurves
oGeomIntents.Add(oSheet.CreateGeometryIntent(oCurve))
Next
Catch
End Try
Next
Wesley Crihfield
(Not an Autodesk Employee)
Can't find what you're looking for? Ask the community or share your knowledge.