How to Create centerline using edge Naming entities from attributes through API

How to Create centerline using edge Naming entities from attributes through API

Anonymous
Not applicable
832 Views
4 Replies
Message 1 of 5

How to Create centerline using edge Naming entities from attributes through API

Anonymous
Not applicable

Hi,

I need a help to create center lines in drawing using Attribute naming edge entity, I had did for ETO its working but need it to convert to API Coding c#. Can any one help?

ETO Rules:

Child Centerline_11 As :IvCenterline
ClosestPoint1 = Point(-1.1953125, 1.50774273, 0.0)
ClosestPoint2 = Point(1.1953125, 1.50774273, 0.0)
entity1 = "Edge47"
entity2 = "Edge48"
intent1 = :centerPoint
intent2 = :centerPoint
Layer = "Centerline (ANSI)"
part1 = STsh2_3B3Smodel
part2 = STsh2_3B3Smodel
Style = "Center Mark (ANSI)"
View = Root.Enclosure_Drawing.sheet2_3.STsh2_3B3SbaseView
Visible? = True

 

0 Likes
Accepted solutions (1)
833 Views
4 Replies
Replies (4)
Message 2 of 5

Michael.Navara
Advisor
Advisor
Accepted solution

This is a complex task which requires a lot of coding.

In background the name of entities are stored in entity Attributes

For determining which attributes and which values are used you can use VBA Locals browser described HERE.

How to search entities by attributes see AttributesManager API 

When you find relevant entities in part and you need to create drawing from assembly, you need to create proxy representation of entity in assembly context. See this article. for more information.

Finally in drawing you need to find drawing curves by model entities and create the centerlines.

 

I hope it helps

 

0 Likes
Message 3 of 5

Anonymous
Not applicable

@Michael.Navara  As per your instructions ,  I Have did till finding of drawing curves, how to add centerline?

Any sample code?

0 Likes
Message 4 of 5

Anonymous
Not applicable

@Michael.Navara  Thanks I had added  created centerlines by collecting intent in the object.

0 Likes
Message 5 of 5

Michael.Navara
Advisor
Advisor

If you want to create Centerline, you can use this example as starting point, and hereis link to Centerlines API

 

    Sub Main()

        Dim cmd As CommandManager = ThisApplication.CommandManager
        Dim line1 As DrawingCurveSegment = cmd.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select line 1")
        Dim line2 As DrawingCurveSegment = cmd.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select line 2")
        CreateBisectorCenterline(line1, line2)
    End Sub


    Function CreateBisectorCenterline(line1 As DrawingCurveSegment, line2 As DrawingCurveSegment) As Centerline
        Dim sheet As Sheet = line1.Parent.Parent.Parent

        Dim entity1 As GeometryIntent = sheet.CreateGeometryIntent(line1.Parent)
        Dim entity2 As GeometryIntent = sheet.CreateGeometryIntent(line2.Parent)
        Dim centermarkStyle As CentermarkStyle = Nothing
        Dim layer As Layer = Nothing

        Dim centerline = sheet.Centerlines.AddBisector(entity1, entity2, centermarkStyle, layer)
        Return centerline
    End Function

 

0 Likes