Feature control frame position

Feature control frame position

adhil.pa.789
Contributor Contributor
231 Views
0 Replies
Message 1 of 1

Feature control frame position

adhil.pa.789
Contributor
Contributor

Hi,

 I'm really stuck at this point. So I am looking for one help

I want to change position of feature control frame below dimension line

 

 

Public Sub H7()
    ' Set a reference to the drawing document.
    ' This assumes a drawing document is active.
    Dim oDrawDoc As DrawingDocument
    Set oDrawDoc = ThisApplication.ActiveDocument

    
    Dim oDrawingDim As DrawingDimension
    Set oDrawingDim = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingDimensionFilter, "Select an dimension")
    
    
    If oDrawingDim.DimensionType = kAlignedDimensionType Then
      Call HorizontalDim(oDrawingDim)
    End If
       
       
       
End Sub
    
Sub HorizontalDim(oDrawingDim As DrawingDimension)
      
    'Set a reference to the active sheet.
    Dim oSheet As Sheet
    Set oSheet = oDrawingDim.Parent.Parent.ActiveSheet
    
    ' Create the feature control frame symbol with a leader
    ' Set a reference to the TransientGeometry object.
     Dim oTG As TransientGeometry
     Set oTG = ThisApplication.TransientGeometry
      
    'assuming that the selection curve is linear
    Dim StartPoint, EndPoint, MidPoint As Point2d
    Set MidPoint = oDrawingDim.DimensionLine.MidPoint
    Set StartPoint = oDrawingDim.DimensionLine.StartPoint
    Set EndPoint = oDrawingDim.DimensionLine.EndPoint
   
    Dim oLeaderPoints As ObjectCollection
    Set oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection
    
      'Create a few leader points with same direction of text position
    'elbow
    If oDrawingDim.DimensionLine.StartPoint.X > oDrawingDim.Text.Origin.X Then
    Call oLeaderPoints.Add(oTG.CreatePoint2d(StartPoint.X - 1.7, StartPoint.Y))

    ElseIf oDrawingDim.DimensionLine.MidPoint.X = oDrawingDim.Text.Origin.X Then
    Call oLeaderPoints.Add(oTG.CreatePoint2d(MidPoint.X, MidPoint.Y))
    
    Else
    Call oLeaderPoints.Add(oTG.CreatePoint2d(EndPoint.X + 1.7, EndPoint.Y))
    
    End If
    
    'Create an intent and add to the leader points collection.
    'This is the geometry that the symbol will attach to.
    Dim oGeometryIntent1 As GeometryIntent
    Set oGeometryIntent1 = oSheet.CreateGeometryIntent(oDrawingDim, MidPoint)
    Call oLeaderPoints.Add(oGeometryIntent1)
     
    ' Create a FeatureControlFrameRows object to define the symbol's rows
    Dim oRows As FeatureControlFrameRows
    Set oRows = oSheet.FeatureControlFrames.CreateFeatureControlFrameRows
    
    ' Add a row
    Dim oRow As FeatureControlFrameRow
    Set oRow = oRows.Add(kPosition, "Ø0.02", , "", "")
    
    ' Create the feature control frame symbol with a leader
    Dim oSymbol As FeatureControlFrame
    Set oSymbol = oSheet.FeatureControlFrames.Add(oLeaderPoints, oRows)
  End Sub

 

 

adhilpa789_1-1672568917477.png

 

 

 

0 Likes
232 Views
0 Replies
Replies (0)