Place dimensions between named entities

Place dimensions between named entities

m_scottW4DSR
Enthusiast Enthusiast
974 Views
20 Replies
Message 1 of 21

Place dimensions between named entities

m_scottW4DSR
Enthusiast
Enthusiast

Seems like it should be straightforward but having so much trouble.

I want to place a dimension between two edges that are iLogic Named Entities

This seems to be simple if oView is of PartDocument.

However, oView is of an AssemblyDocument and the named entities exist in separate subparts of the assembly.

How do I create the GeometryIntents of the Named Entities?

0 Likes
Accepted solutions (2)
975 Views
20 Replies
Replies (20)
Message 21 of 21

C_Haines_ENG
Collaborator
Collaborator
Accepted solution

LeafOccurrences are ALL occurrences in an assembly. If you just cycle through Occurrences you will only get the first level, but if you had an assembly inside an assembly, and wanted to access the parts within it, you need to use LeafOccurrences.

 

oCurves.Count is representing how many "Lines" are on the drawing that are a result of the named entity. For example, if you targeted a face, and on the drawing you could only see one edge of that face, oCurves.Count would return 1. If you could see the whole face (assuming its a square) it would return 4.

 

I managed to get this working with the files you provided:

Sub Main

	Dim oDoc As DrawingDocument = ThisDoc.Document

	Dim oSheet As Sheet = oDoc.ActiveSheet
	Dim oView As DrawingView = oDoc.ActiveSheet.DrawingViews(1)
	Dim oAsm As AssemblyDocument = oView.ReferencedDocumentDescriptor.ReferencedDocument

	Dim oEntity1 As Object, oEntity2 As Object

	For Each oComp As ComponentOccurrence In oAsm.ComponentDefinition.Occurrences.AllLeafOccurrences

		Dim oNamedEnts As NamedEntities = iLogicVb.Automation.GetNamedEntities(oComp.Definition.Document)

		If oComp.Name.Contains("RH Track")
			oEntity1 = oNamedEnts.FindEntity("Edge0")
			oComp.CreateGeometryProxy(oEntity1, oEnt1Proxy)
		End If

		If oComp.Name.Contains("MRR Spiral")
			oEntity2 = oNamedEnts.FindEntity("Edge4")
			oComp.CreateGeometryProxy(oEntity2, oEnt2Proxy)
		End If

	Next

	Dim oCurve1 As DrawingCurve = oView.DrawingCurves(oEnt1Proxy)(1)
	Dim oCurve2 As DrawingCurve = oView.DrawingCurves(oEnt2Proxy)(1)

	Dim oInt1 As GeometryIntent = oSheet.CreateGeometryIntent(oCurve1, kStartPointIntent)
	Dim oInt2 As GeometryIntent = oSheet.CreateGeometryIntent(oCurve2, kStartPointIntent)

	Dim GenDims As GeneralDimensions = oSheet.DrawingDimensions.GeneralDimensions
	Dim oPoint As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(0, 0)
	GenDims.AddLinear(oPoint, oInt1, oInt2, kVerticalDimensionType)

End Sub