Add feature control frame to general dimension

Add feature control frame to general dimension

adhil.pa.789
Contributor Contributor
557 Views
4 Replies
Message 1 of 5

Add feature control frame to general dimension

adhil.pa.789
Contributor
Contributor

Can anyone help to create code for adding feature control frame to general dimension. sample feature control given below

 image.png

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

JelteDeJong
Mentor
Mentor
Accepted solution

I think that the following rule will do precisely what you want. But it is not very flexible. It will turn the feature control frame always 90 deg also if you don't want it for other dimensions. And it's moved to the left from the dimension text. That is only good if you have a vertical dimension. For horizontal dimensions that is not good...

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.02", "", "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,
    textPoint.Y)
pointCollection.Add(position)

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

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

 

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 3 of 5

adhil.pa.789
Contributor
Contributor
Thanks for your support.
Is it vba code? I need vba code.some error occurred while running
0 Likes
Message 4 of 5

JelteDeJong
Mentor
Mentor
Accepted solution

This is iLogic code (or to be exact VB.net code). It would be better if you did not write VBa any more. VBa is obsolete. (But for now you can still make it work...) For more information see this blog post "Is VBA in Inventor obsolete?"

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 5 of 5

adhil.pa.789
Contributor
Contributor
0 Likes