Craete labels for geometry

Craete labels for geometry

cencinaNB2ET
Advocate Advocate
587 Views
2 Replies
Message 1 of 3

Craete labels for geometry

cencinaNB2ET
Advocate
Advocate

 

i Want to add geometry ilogic entity names on the geometry tab,

i know the number of the edge internally used the attribute set to look for it but now i have to work backwards since its a derived part and those names were lost, only the edge number i kept through a custom iproperty.

can i create those labels with ilogic???

 

this is what i have so far.

Dim oPart As PartDocument = ThisDoc.Document
Dim oPrtDef As PartComponentDefinition = oPart.ComponentDefinition


Dim Edge_Number_1 As Double = iProperties.Value("Custom","Left Hole Edge Number")
Dim Edge_Number_2 As Double = iProperties.Value("Custom","Right Hole Edge Number")


Dim Edge_Name_1 As String = iProperties.Value("Custom","Left Hole Edge Name")
Dim Edge_Name_2 As String = iProperties.Value("Custom","Right Hole Edge Name")


Dim oEdge1 As Edge
Dim oEdge2 As Edge

Dim entity_1 As Object
Dim entity_2 As Object


Dim oInsert As InsertConstraint
Dim oEdges As Edges
Dim AttSets As AttributeSets
Dim oAttribSet As AttributeSet
Dim oAttrib As Inventor.Attribute


For x = 1 To oPrtDef.SurfaceBodies(1).Edges.Count
oEdge = oPrtDef.SurfaceBodies(1).Edges.Item(x)
If x = Edge_Number_1 Then
entity_1 = oEdge
oEdge1 = oEdge
entity_1 = oEdge1
AttSets = oEdge1.AttributeSets
If AttSets.NameIsUsed("iLogicEntityNameSet") = True Then
oAttribSet = AttSets.Item("iLogicEntityNameSet")
oAttrib = oAttribSet.Item("iLogicEntityName")
oAttrib.Value = Edge_Name_1
End If
End If


If x = Edge_Number_2 Then
oEdge2 = oEdge
entity_1 = oEdge2
AttSets = oEdge2.AttributeSets
If AttSets.NameIsUsed("iLogicEntityNameSet") = True Then
oAttribSet = AttSets.Item("iLogicEntityNameSet")
oAttrib = oAttribSet.Item("iLogicEntityName")
oAttrib.Value = Edge_Name_2
End If
End If
Next x
	
	
	
	
	
	
	
	
	
	
	




 

 

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

AlexFielder
Advisor
Advisor

This rule of mine might help (linked in case I update it in future!):

 

'this rule will attempt to look at a supplied assembly and dimensions the extents of a group of objects that are constrained together.
Sub Main()
    'This rule will create delete any existing iLogic-created dimensions before replacing them anew
    Dim oDWG As DrawingDocument = ThisDoc.Document

    Dim oSht As Sheet = oDWG.ActiveSheet

    Dim oView As DrawingView = ActiveSheet.View("VIEW1").View

    Dim oPart As PartDocument = ActiveSheet.View("VIEW1").ModelDocument

    Dim TransG As TransientGeometry = ThisApplication.TransientGeometry
'break
    Dim oGenDims As GeneralDimensions = oSht.DrawingDimensions.GeneralDimensions

   	Dim datumObjs As ObjectCollection = oPart.AttributeManager.FindObjects("iLogicEntityNameSet", "iLogicEntityName","END01")
	Dim outObjs As ObjectCollection = oPart.AttributeManager.FindObjects("iLogicEntityNameSet", "iLogicEntityName","END02") 'ThisApplication.TransientObjects.CreateObjectCollection

    Dim aoEdge1 As face


'break

    	aoEdge1 = datumObjs.Item(1)
		Break

    Dim aoEdge2 As Face

'break
    aoEdge2 = outObjs.Item(1)

    Dim oDrawCurve1 As DrawingCurve

    oDrawingCurves = oView.DrawingCurves(aoEdge1)
break
    oDrawCurve1 = oDrawingCurves.Item(1)

    Dim oDrawCurve2 As drawingcurve

    oDrawingCurves = oview.DrawingCurves(aoEdge2)
break
    oDrawCurve2 = oDrawingCurves.Item(1)

    Dim oPt1 As Point2d = TransG.Createpoint2d(oView.left + (oView.Width / 4), oView.Top - (oView.Height) - 1)

    messagebox.show("Got dimension line point position: " & oPt1.X.ToString() & "," & oPt1.Y.ToString())

    Dim oDim1 As GeneralDimension = oGenDims.AddLinear(oPt1, oSht.CreateGeometryintent(oDrawCurve1, PointIntentEnum.kStartPointIntent), oSht.CreateGeometryIntent(oDrawCurve2, PointIntentEnum.kEndPointIntent), DimensionTypeEnum.kHorizontalDimensionType)

    messagebox.show("Dimension Added.")

    Dim odimatt1 As Attributeset = oDim1.Attributesets.add("iLogic_Created")

End Sub

You might look at it and go "well that's not relevant" but it is using a set of "Named Geometry" objects. If you know how to create attributes already (and from reading OP it seems like you do) then swap in the names in my code ^ to access the relevant objects.

 

I also have another rule which I was writing a while back which aimed to push existing-named geometry into derived parts. Unfortunately, it's been 6 months or so since I looked at it, and I can't remember whether I had gotten it working or not. You're welcome to take a look at the approach I was taking and if I can make it work in my-context I'll post the code here.

0 Likes
Message 3 of 3

AlexFielder
Advisor
Advisor

I updated the thread here because I successfully pushed named geometry into derived components with one snag that they don't show up in the "Geometry" tab within the iLogic browser.

 

Hopefully Autodesk can advise whether it's actually possible to do this manually i.e. without using the right-click functionality available in the UI.

0 Likes