Auto-dimensioning edge entities of iParts

Auto-dimensioning edge entities of iParts

harvey_craig2RCUH
Advocate Advocate
236 Views
2 Replies
Message 1 of 3

Auto-dimensioning edge entities of iParts

harvey_craig2RCUH
Advocate
Advocate

I wish to create a tool that auto dimensions my assemblies. A lot of my parts have the same profiles in different sizes so have been made as iParts. I've discovered that at this stage I can access the entities of a part in an assembly by referencing the (partname, entity) but this does not work for iParts. Do I have to recreate all these iParts as regular parts so I can do this?

 

harvey_craig2RCUH_0-1722872473684.png

Attempting to create an entity on an ipart in an assembly.

 

 

 

 

I can do this for parts that are not iParts like this:

Dim HYD_A4_1 = ThisDrawing.Sheets.ItemByName("HYD-A4:1")
Dim VIEW1 = HYD_A4_1.DrawingViews.ItemByName("VIEW1")
Dim _12BSPPFemSwiv_Large = VIEW1.GetIntent("BSPP Female Swivel", "-12BSPPFemSwiv_LargeDia")
Dim genDims = HYD_A4_1.DrawingDimensions.GeneralDimensions
ThisDrawing.BeginManage()
If True Then 
	Dim _12BSPPFemSwiv_LargeDiaDim = genDims.AddDiameter("Dimension 1", VIEW1.SheetPoint(-0.1, 0.5), _12BSPPFemSwiv_Large)
End If
ThisDrawing.EndManage()

harvey_craig2RCUH_1-1722873247766.png

 

Is there a way I can do this for my iParts or do I have to recreate them all as regular parts?

 

0 Likes
237 Views
2 Replies
Replies (2)
Message 2 of 3

Curtis_Waguespack
Consultant
Consultant

@harvey_craig2RCUH , I think this is just limitation of iparts/ilogic iPart members do not inherit the factory named geometry or work features, so we can not dimension them with iLogic as far as I know. 

 

When we constrain to ipart members in an assembly, ilogic will create proxy geometry, but I don't know of a way to have it do something similar for drawings.

 

You can likely find something on here to save out each row of the ipart as a standard part to make converting them back to standard parts easier.

EESignature

0 Likes
Message 3 of 3

harvey_craig2RCUH
Advocate
Advocate

Hi Curtis, 

 

The news of having to convert all my iParts to parts put me off doing this for a while. I found a rule that separated the iParts into regular parts however it just broke the link from the factory and created as a 'solid' so the sketch wasn't retained, so if a change is required, it would not be possible.

 

My new thing is just naming the entitles inside the member file. You cannot do this in the UI for some reason. But you can create an external rule and that will do it. I have placed them in the assembly and it works. The rule names all the edges and faces. I then identify the ones I want to change to my own custom names that match my auto-dimensioning rules in the drawing, then it deletes the rest. I then run the external rule in all the other sizes of the part and because they all share the same profile, Inventor names the entities in the same order. It's clunky because I wrote it, but it works. I'm just showing you this if you're interested (no question):

oDoc = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition
oCompDef = oDoc.ComponentDefinition

Dim oEdge As Edge
Dim EdgeName As NamedEntities = iLogicVb.Automation.GetNamedEntities(oDoc)

For x = 1 To oCompDef.SurfaceBodies.Item(1).Edges.Count
	oEdge = oCompDef.SurfaceBodies.Item(1).Edges.Item(x)
	EdgeName.SetName(oEdge, "Edge" & x) 'This labels every edge.
Next

Dim oFace As Face
Dim FaceName As NamedEntities = iLogicVb.Automation.GetNamedEntities(oDoc)

For x = 1 To oCompDef.SurfaceBodies.Item(1).Faces.Count
	oFace = oCompDef.SurfaceBodies.Item(1).Faces.Item(x)
	FaceName.SetName(oFace, "Face" & x)'This labels every Face.
Next

'This section is for renaming a deleting unwanted edges.
Dim oCompDef1 As ComponentDefinition = ThisApplication.ActiveDocument.ComponentDefinition
Dim oNamedEntities = iLogicVb.Automation.GetNamedEntities(ThisApplication.ActiveDocument)
For Each oEdge In oCompDef1.SurfaceBodies(1).Edges
	If oNamedEntities.GetName(oEdge) = "Edge2" Then
		oNamedEntities.SetName(oEdge, "E1")
		
	Else If oNamedEntities.GetName(oEdge) = "Edge3" Then
		oNamedEntities.SetName(oEdge, "E2")
		
	Else If oNamedEntities.GetName(oEdge) = "Edge4" Then
		oNamedEntities.SetName(oEdge, "E3")
		
	Else 
		oNamedEntities.DeleteName(oEdge)
	End If
Next

'This section is for renaming a deleting unwanted faces.
For Each oFace In oCompDef1.SurfaceBodies(1).Faces
	If oNamedEntities.GetName(oFace) = "Face5" Then
		oNamedEntities.SetName(oFace, "InternalFace")
		
	Else If oNamedEntities.GetName(oFace) = "Face3" Then
		oNamedEntities.SetName(oFace, "SealFace")
		
	Else If oNamedEntities.GetName(oFace) = "Face7" Then
		oNamedEntities.SetName(oFace, "GrooveFace")
		
	Else 
		oNamedEntities.DeleteName(oFace)
	End If
Next

 

harvey_craig2RCUH_0-1724324001019.png

 

0 Likes