VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Pickfirst working only while VBA routine running from visual basic editor

1 REPLY 1
SOLVED
Reply
Message 1 of 2
remy.baud
425 Views, 1 Reply

Pickfirst working only while VBA routine running from visual basic editor

Hi Guys,

 

I have an issue with the pickfirst selection in my VBA Routine.

 

If i run my VBA routine using the visual basic editor Run->Run, ThisDrawing.PickfirstSelectionSet.Count works correctly and display the number of the current selected objects in Autocad.

 

But...

Now if i run this VBA routine using a command via Lisp OR using a Custom button, ThisDrawing.PickfirstSelectionSet.Count ALWAYS shows "0".

 

Someone did already experience this issue?!

 

The List function to start the vba routine is:

--------------------------------------------------------

(defun C:rotobj ()
(vl-load-com)
(vl-vbarun "acad.dvb!RotateObjects")
)

 

Alternatively, the command behind the Custom button is:

-----------------------------------

-vbarun;RotateObjects

-----------------------------------

 

regards

1 REPLY 1
Message 2 of 2
remy.baud
in reply to: remy.baud

Accordind to this post:

http://forums.autodesk.com/t5/Visual-Basic-Customization/Pickfirst-selection-set/td-p/300452

 

We should use instead of "vbarun"  the "vla-RunMacro" function, because vbarun clears the pick first selection set.

 

(defun C:MyCommand ()
(vl-load-com)
(setq applic (vlax-get-acad-object))
(vla-RunMacro applic "acad.dvb!MyCommandMacro")
(princ)
)

 

 

and it works fine form me

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost