AnsweredAssumed Answered

How Set the Length of Magnet Line on Drawing?

Question asked by Abhishek Lad on Dec 10, 2019
Latest reply on Dec 11, 2019 by Rajat Jain

Hello all,

I need API/Macro help to set the length of magnet line following is my code.

 

Dim instance As MagneticLine
Dim value As System.Double =150

 

boolstatus = oDoc.Extension.SelectByID2("MagneticLine1@Drawing View1", "MAGNETLINE", 0, 0, 0, False, 0, Nothing, 0)
swSelectionManager = oDoc.SelectionManager
instance = swSelectionManager.GetSelectedObject5(swSelectType_e.SwSelMAGNETICLINES)
instance.Length = value
oDoc.Rebuild3()

 

Above code giving error :=="Object reference not set to an instance of an object.'"

when i debug it , in instance  their is nothing i.e. no object of magnet line. 

I  changed instance = swSelectionManager.GetSelectedObject6(1, 0) but still in instance  their is nothing.

IF anyone know what is the correct way of magnet line selection please help me.

 

Thank you

 

Outcomes