Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
checkcheck_master
350 Views, 1 Reply

Drawing - Connected Detail View - AttachPoint question - VBA or iLogic

I would like to be able to place a Connected Detail View with iLogic where the user is asked about 'which drawing view', 'center of the fence' and 'center of the detail view'.
See VBA code, just that.


Apart from that, I would like to be able to choose an AttachPoint in the VBA I'm using now after the Detail View is placed or choose ESC if not wanted.
What else do I need to do other than select Geometry as Variant?
See picture, the help says 'AttachPoint as Variant - Optional input GeometryIntent object that specifies the geometry to attach the detail view to.'

I get the feeling that I still have to do something with GeomtreyInent?

In the 1st code example you see the part where I'm struggling with.

 

Please help, thanks in advance.

 

' Ask for an Attach Point for a fixed detailview
    Dim oAttachPointSel As Variant
    Set oAttachPointSel = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Please select geometry to Attach the drawing view to or ESC")
    Dim oAttachPoint As GeometryIntent
    oAttachPoint = oAttachPointSel
Public Sub Detail_View_Circle_VBA()

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

   '----------------------------------------------------------------------------------------------------
   ' Undo Wrapper
   Dim trans As Transaction
   Set trans = ThisApplication.TransactionManager.StartTransaction(oDrawDoc, "Do your thing")
   '----------------------------------------------------------------------------------------------------
    
    ' Set a reference to the active sheet.
    Dim oSheet As Sheet
    Set oSheet = oDrawDoc.ActiveSheet
      
    ' Select a drawing view
    Dim oDrawingView As DrawingView
    Set oDrawingView = ThisApplication.CommandManager.Pick(kDrawingViewFilter, "Select a drawing view.")
    
    ' Select the center of the circular fence
    Dim getPoint As New clsGetPoint
    
    Dim oCenterPoint As Point2d
    Set oCenterPoint = getPoint.GetDrawingPoint("Please select the center point of the fence", kLeftMouseButton)
    
    ' Select the place where the detailed view need to be placed
    Dim oPoint As Point2d
    Set oPoint = getPoint.GetDrawingPoint("Please select the center location for the detailed view", kLeftMouseButton)
        
    ' Create the detail view
    Dim oDetailView As DetailDrawingView
    Set oDetailView = oSheet.DrawingViews.AddDetailView(oDrawingView, oPoint, kFromBaseDrawingViewStyle, True, oCenterPoint, 0.5, , oDrawingView.Scale * 2, False, " ")
        
    ' Set breakline to smooth
    oDetailView.IsBreakLineSmooth = True
    ' Show full detail boundary
    oDetailView.DisplayFullBoundary = True
    ' Show connection line
    oDetailView.DisplayConnectionLine = True
        
'    ' Ask for an Attach Point for a fixed detailview
'    Dim oAttachPointSel As Variant
'    Set oAttachPointSel = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Please select geometry to Attach the drawing view to or ESC")
'    Dim oAttachPoint As GeometryIntent
'    oAttachPoint = oAttachPointSel
'
'    oDetailView.AttachPoint = oAttachPoint
        
    ' Set detailview to "Parts"
    ' this assumes that there is an detailview called "Parts", if not, delete this line
    On Error Resume Next
    Call oDetailView.SetDesignViewRepresentation("Parts", False)
    
    '----------------------------------------------------------------------------------------------------
   ' Undo Wrapper
   trans.End
   '----------------------------------------------------------------------------------------------------

End Sub