AnsweredAssumed Answered

Get selected Blockinstance in Drawing

Question asked by Sascha Smolny on Aug 16, 2016
Latest reply on Aug 18, 2016 by Ivana Kolin

Hello,

 

how can i get the selected Blockinstance in a Drawing (Selected in the Grapics Area) ?

If i select a point from the Block i can get this point with:

    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Dim swSelMgr As SldWorks.SelectionMgr
        
    Set swApp = CreateObject("SldWorks.Application")
    Set swModel = swApp.ActiveDoc
    Set swSelMgr = swModel.SelectionManager
    
    
    Dim swSketchPt As SketchPoint
    Set swSketchPt = swSelMgr.GetSelectedObject6(1, -1)

 

If i select a Line from the Block i can get this with:

    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Dim swSelMgr As SldWorks.SelectionMgr
        
    Set swApp = CreateObject("SldWorks.Application")
    Set swModel = swApp.ActiveDoc
    Set swSelMgr = swModel.SelectionManager


    Dim swSkSeg As SldWorks.SketchSegment
    Set swSkSeg = swSelMgr.GetSelectedObject6(1, -1)


 

But how can i get the selected Block?

 

Regards,

Sascha

 

[edit]

I can get it only, when i use selection Filter and select the Block. But i want use it without the selection Filter.

   Dim swSkBlockInstance As SldWorks.SketchBlockInstance
   Set swSkBlockInstance = swSelMgr.GetSelectedObject6(1, -1)

 

[/edit]

Outcomes