Place dimensions between named entities

Place dimensions between named entities

m_scottW4DSR
Enthusiast Enthusiast
969 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)
970 Views
20 Replies
Replies (20)
Message 2 of 21

C_Haines_ENG
Collaborator
Collaborator

Do you think you could upload a test file that has the same file structure as the one you're working with? May be as simple as cycling through All Leaf Occurrences

 

Could be something more complex. Hard to know without a reference.

 

0 Likes
Message 3 of 21

m_scottW4DSR
Enthusiast
Enthusiast

Files attached. Explanation in .dwg

Message 4 of 21

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @m_scottW4DSR 

 

You can extract the syntax to do this from the drawing view, and trade out the entity names. See video ( the video is a bit clumsy, but it'll give the idea)

 

Hope that helps, 

Curtis

 

EESignature

Message 5 of 21

m_scottW4DSR
Enthusiast
Enthusiast

Thank you, @Curtis_Waguespack .  So happy to see you back in the Forums.

 

Your book was the best of its kind, and i've been thru many, on many platforms.  I would buy a revised edition, not because I need it, but to pass it on to the next youngster that does.

Message 6 of 21

Curtis_Waguespack
Consultant
Consultant

Thanks for the kind words @m_scottW4DSR 

 

revised edition is not likely, as it seems the "youngsters" don't prefer books 🙂

EESignature

0 Likes
Message 7 of 21

m_scottW4DSR
Enthusiast
Enthusiast

As a follow-up to any readers or Autodesk developers:  Named Entities are not recognized by the iLogic code above when in a multi-body .ipt

Took me about 4 hours to figure that out.

 

Edit: I was mistaken

 

 

 

0 Likes
Message 8 of 21

C_Haines_ENG
Collaborator
Collaborator

Did you manage to get it all working then?

0 Likes
Message 9 of 21

m_scottW4DSR
Enthusiast
Enthusiast
The problem is something else that I haven't figured out.
I think I read a post that I can't find ATM, the issue being referencing the named entity in a projected view.
0 Likes
Message 10 of 21

C_Haines_ENG
Collaborator
Collaborator

Try this bit of code, I have this working with multi-solid parts in an assembly. Its searching for a named face called "Top" but you can see where you can change that. It isn't getting geometry intent but that's not too hard once you have the DrawingCurves. This is just to check that you CAN get the drawing curves of the named entities you want. 

 

Sub Main

	Dim oDoc As DrawingDocument = ThisDoc.Document

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

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

		Dim oNamedEnts As NamedEntities = iLogicVb.Automation.GetNamedEntities(oComp.Definition.Document)
		
		Try
			
			Dim oFace As Face = oNamedEnts.FindEntity("Top")
			oComp.CreateGeometryProxy(oFace, oFaceProxy)
			Dim oCurves As DrawingCurvesEnumerator = oView.DrawingCurves(oFaceProxy)
			MsgBox(oComp.Name & " Has " & oCurves.Count & " Visible Lines in This Drawing")
				
		Catch
			
			MsgBox(oComp.Name & " Has No Visible, Or Named Entities!")
			
		End Try
	

	Next

End Sub

 

Message 11 of 21

m_scottW4DSR
Enthusiast
Enthusiast

Files attached.  iLogic code in .dwg as demonstrated by @Curtis_Waguespack above.

 

I have used this template of code successfully in other contexts.  I am at a loss why it is not working here.  I am unable to place any of the dimensions.

 

 

0 Likes
Message 12 of 21

C_Haines_ENG
Collaborator
Collaborator

Did my code not work...? I will try with your files when I have access to a more modern version of inventor. 

0 Likes
Message 13 of 21

m_scottW4DSR
Enthusiast
Enthusiast

Working thru your code, now.  

The issue with my code is not in finding the entities and creating the intents.  It fails when placing the dimension.

0 Likes
Message 14 of 21

C_Haines_ENG
Collaborator
Collaborator

My code is just checking that it can reliably find the geometry of the named entities in the drawing. It doesn't get intent yet, but I prefer to start simple and build from there rather than try the entire code at once and work backwards.

 

If the message box is getting the correct components, and is giving the correct amount of visible faces better than your code getting geometry intent will be a cake walk.

0 Likes
Message 15 of 21

Curtis_Waguespack
Consultant
Consultant

@m_scottW4DSR your data set is missing this file

 

Curtis_Waguespack_0-1737044343660.png

 

EESignature

0 Likes
Message 16 of 21

m_scottW4DSR
Enthusiast
Enthusiast

@Curtis_Waguespack  You should be able to work without it

 

Edit: I created this .ipt as a simplified representation of the .iam.  It may be the cause of the problem.  I did this because it seems that named entities only exist in an .ipt and the face I wanted to define is several subOccurrences deep.

 

m_scottW4DSR_0-1737046105347.png

 

0 Likes
Message 17 of 21

m_scottW4DSR
Enthusiast
Enthusiast

@Curtis_Waguespack  attached

0 Likes
Message 18 of 21

m_scottW4DSR
Enthusiast
Enthusiast

@Curtis_Waguespack Replaced the derived MMR Spiral.ipt with MMR Spiral.iam.  No improvement.

0 Likes
Message 19 of 21

m_scottW4DSR
Enthusiast
Enthusiast

Thanks @Curtis_Waguespack and @C_Haines_ENG for your help.  I have solved the issue but not really sure how.  Not sure why, but by suppressing some of the subParts in the assembly, the drawingView was able to "see" the intents and place the dimension (I have no idea if this is an accurate explanation of what really is happening).  Then I unsupressed the subParts and the dims would still be placed.  

 

It's taken me a better part of a week just to place 4 dimensions on my drawing.  Happy coding y'all!

Message 20 of 21

m_scottW4DSR
Enthusiast
Enthusiast

@C_Haines_ENG The iLogic code ran as it should.  I don't quite understand what the LeafOccurrences are, or what the items in oCurves.Count represent.