iLogic - Select two lines and arrowheads are joined together

iLogic - Select two lines and arrowheads are joined together

Viktor.Lukjanow
Advocate Advocate
348 Views
3 Replies
Message 1 of 4

iLogic - Select two lines and arrowheads are joined together

Viktor.Lukjanow
Advocate
Advocate

Hello,
is it possible to write an iLogic that does the following for me. Select two lines and arrowheads are joined together.
step 1

ViktorLukjanow_0-1709294764445.png

then

ViktorLukjanow_1-1709294813749.png

I would be very thankful for a solution

0 Likes
Accepted solutions (1)
349 Views
3 Replies
Replies (3)
Message 2 of 4

Viktor.Lukjanow
Advocate
Advocate

I think there is a Solution like this Code:

Dim oTg = ThisApplication.TransientGeometry
Dim doc As DrawingDocument = ThisDoc.Document
Dim sheet As Sheet = doc.ActiveSheet
Dim dimension = ThisApplication.CommandManager.Pick(
	SelectionFilterEnum.kDrawingDimensionFilter, 
	"Select a VERICAL dimension")

Dim rows As FeatureControlFrameRows = sheet.FeatureControlFrames.CreateFeatureControlFrameRows()
rows.Add(GeometricCharacteristicEnum.kPosition, "Ø0.015", "", "A",)

Dim pointCollection = ThisApplication.TransientObjects.CreateObjectCollection()

Dim textPoint = dimension.Text.Origin
' move the FeatureControlFrame away from the text.
Dim position As Point2d = oTg.CreatePoint2d(
    textPoint.X + 1.0,
    textPoint.Y +4.0)
pointCollection.Add(position)

' Add the Next 2 lines if you want a leader 
'Dim intent = sheet.CreateGeometryIntent(dimension, dimension.DimensionLine.MidPoint)
Dim intent = sheet.CreateGeometryIntent(dimension, dimension.DimensionLine.StartPoint)
'Dim intent = sheet.CreateGeometryIntent(dimension, dimension.DimensionLine.EndPoint)
pointCollection.Add(intent)

Dim fcf = sheet.FeatureControlFrames.Add(pointCollection, rows)
fcf.Rotation = (Math.PI / 180) * 90

But here I create a FeatureControlFrames. And set it to an end point or a start point.

And now I need a Pick Selection to select two lines and intent them together.
Any idea?


 

0 Likes
Message 3 of 4

JelteDeJong
Mentor
Mentor
Accepted solution

Run this rule. Then select a frame and a dimension.

Dim doc As DrawingDocument = ThisDoc.Document
Dim sheet As Sheet = doc.ActiveSheet

Dim frame As FeatureControlFrame = ThisApplication.CommandManager.Pick(
	SelectionFilterEnum.kDrawingFeatureControlFrameFilter,
	"Feature control frame ")

Dim dimension As DrawingDimension = ThisApplication.CommandManager.Pick(
	SelectionFilterEnum.kDrawingDimensionFilter,
	"Select Dimension")

Dim node As LeaderNode = frame.Leader.AllLeafNodes.Item(1)

Dim segment As LineSegment2d = dimension.DimensionLine

Dim diff1 = Math.Abs(segment.StartPoint.X - node.Position.X) ^ 2 + Math.Abs(segment.StartPoint.Y - node.Position.Y) ^ 2
Dim diff2 = Math.Abs(segment.EndPoint.X - node.Position.X) ^ 2 + Math.Abs(segment.EndPoint.Y - node.Position.Y) ^ 2

If (diff1 < diff2) Then
	node.Position = segment.StartPoint
Else
	node.Position = segment.EndPoint
End If

Dim intent = sheet.CreateGeometryIntent(dimension, node.Position)

node.AttachedEntity = intent

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 4 of 4

Viktor.Lukjanow
Advocate
Advocate

Amazing - THX - JelteDeJong

0 Likes