PickfirstSelectionSet

PickfirstSelectionSet

Anonymous
Not applicable
1,039 Views
15 Replies
Message 1 of 16

PickfirstSelectionSet

Anonymous
Not applicable

I have a little problem, i like to use the PickfirstSelectionSet.

When you select the objects before you start the program you will see the grips and the selection.

Now i want to clear the grips and the selection.


Is this possible with VBA? I could't find anything, maybe it is possible with vlisp?

0 Likes
1,040 Views
15 Replies
Replies (15)
Message 2 of 16

Anonymous
Not applicable

OK, i forgot to tell you a little bit more.


I want to start the vba-program with a button on a toolbar


First i created a, for example, Test.mnu

I have an Button like this


ID_CopyLayCurr [_Button("Copy to current Layer", "CopyLayCurr.bmp",
"CopyLayCurr.bmp")]^C^CCoLayCur;


and a Test.mnl with this


(defun c:CoLayCur (/) (vla-runmacro(vlax-get-acad-object) "acad.dvb!modify.CopyLayerCurrent"))


When i select some objects befor the command, the objects will be selected
after the command.

What do i have to do that i can use the pickfirstselectionset with a toolbar?

0 Likes
Message 3 of 16

Anonymous
Not applicable
Will the "ActiveSelectionSet" property help. Here are some things you can do
with it.

Gary

Dim oEnt As AcadEntity

MsgBox ThisDrawing.ActiveSelectionSet.Count
ThisDrawing.ActiveSelectionSet.Highlight False
ThisDrawing.ActiveSelectionSet.Clear

For Each oEnt In ThisDrawing.ActiveSelectionSet
ThisDrawing.ActiveSelectionSet.RemoveItems oEnt
Next

ThisDrawing.ActiveSelectionSet.Erase
0 Likes
Message 4 of 16

Anonymous
Not applicable

Hallo Gary,


this is not the answer to this problem, sorry.

The ActiveSelectionSet returns the same as the PickfirstSelectionSet.

The problem is, that i don't know how to start a vbaprogramm with a button at
the toolbar.


When i set a command with

(defun c:CoLayCur (/) (vla-runmacro(vlax-get-acad-object) "acad.dvb!modify.CopyLayerCurrent"))

the command starts with the selection but the selection will not be cleared
after the command.


When i use following to set a command

(defun c:colaycur (/) (command "_-vbarun" "modify.CopyLayerCurrent"))

the selection will be cleared and i have to select the objects again.


Therefore my question, i can not believe that there is no one who had this
problem before.

I try to find a solution since four days but nobody could help me till today.


So please HELP me.

0 Likes
Message 5 of 16

Anonymous
Not applicable
Roland,

I don't use vlisp very much, but I don't think you need the statement:
(vlax-get-acad-object)

I always use vl-vbarun, something like this:
(defun c:CL1 (/) (vl-vbarun "modify.CopyLayerCurrent"))

A VBA program can be loaded (without the pesky dialog box) something like
this:
(vl-vbaload "C:\\Test\\My_VBA_Program.dvb")

I'm not sure I fully understand your problem but I hope this helps.

Gary
0 Likes
Message 6 of 16

Anonymous
Not applicable
Roland,

I believe you are out of luck on this with what's
currently available in the VBA object model. You can look into the .Highlight
method for selection sets, but I think you will find (as I did) that this does
not sufficiently 'deselect' objects. The objects will be deselected, but the
grips will still be visible (akin to hitting the escape key only once in 2002
products). I experience the same behavior you see, and have looked for a work
around too. Seems like we need a .Gripped property that we could set to false at
the end of a macro in order to make this work.


size=2>

Kevin


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

Hallo Gary,


this is not the answer to this problem, sorry.
  The
ActiveSelectionSet returns the same as the
PickfirstSelectionSet.
  The problem is, that i don't know how to
start a vbaprogramm with a button at
  the toolbar.


When i set a command with
  (defun c:CoLayCur (/)
(vla-runmacro(vlax-get-acad-object)
"acad.dvb!modify.CopyLayerCurrent"))

  the command starts
with the selection but the selection will not be cleared
  after
the command.


When i use following to set a command
  (defun c:colaycur
(/) (command "_-vbarun" "modify.CopyLayerCurrent"))

  the
selection will be cleared and i have to select the objects again.


Therefore my question, i can not believe that there is no one who had this

  problem before.
  I try to find a solution since
four days but nobody could help me till today.


So please HELP me.

0 Likes
Message 7 of 16

Anonymous
Not applicable
heres a notes i found in past posts here via google, author unknown

"vla-runmacro will prevent you from picking on screen while a userform is
hidden
as you say. As I understand it, this is because it causes your VBA macro to
be
run in the application context rather than in the document context. If you
need
to be able to do this, the easiest fix is to use vl-vbarun. However, there
are
a couple of important points to note:

vla-runmacro is the only method I am aware of that will allow you to use the
PickFirstSelectionSet, and it is also the only method I know of that will
allow
you to click a toolbar button while running a vba macro without crashing the
macro."

basically i don't think they have any good way to start vba from lisp.
either way you use has problems, too many print statements on command line
etc....
sadly it doesn't seem like they plan to fix any of it in the near future
either.

if you just need to clear your selection set you can (ssgetfirst nil nil) at
the end of your lisp.
hth
mark

"RolandF" wrote in message
news:f1969ec.2@WebX.maYIadrTaRb...
> Hallo Gary,
>
>
> So please HELP me.
>
0 Likes
Message 8 of 16

Anonymous
Not applicable
Thank you to all.

Isn't it crazy, there is a pickfirstSelectionSet and you can not do anything with it.

Is it possible to use (ssgetfirst nil nil) at the end of an vbaprogramm in any way?
0 Likes
Message 9 of 16

Anonymous
Not applicable
It should be (ssseetfirst nil nil), and you can do
it like this:

 

    ThisDrawing.SendCommand
"(sssetfirst nil nil)" & vbLf


size=2>

Kevin


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Thank
you to all.
Isn't it crazy, there is a pickfirstSelectionSet and you can
not do anything with it.
Is it possible to use (ssgetfirst nil nil) at the
end of an vbaprogramm in any way?
0 Likes
Message 10 of 16

Anonymous
Not applicable
I believe the author was me, and I only got it half right. vla-runmacro
actually executes your macro in the DOCUMENT context (not the application
context). *hangs head*

Note to self: If you only think you know the answer, don't post. 😃


"Mark Propst" wrote in message
news:412CA64AC804AD6E874EB5EF76622BE6@in.WebX.maYIadrTaRb...
> heres a notes i found in past posts here via google, author unknown
>
> "vla-runmacro will prevent you from picking on screen while a userform is
> hidden
> as you say. As I understand it, this is because it causes your VBA macro to
> be
> run in the application context rather than in the document context. If you
> need
> to be able to do this, the easiest fix is to use vl-vbarun. However, there
> are
> a couple of important points to note:
>
> vla-runmacro is the only method I am aware of that will allow you to use the
> PickFirstSelectionSet, and it is also the only method I know of that will
> allow
> you to click a toolbar button while running a vba macro without crashing the
> macro."
>
> basically i don't think they have any good way to start vba from lisp.
> either way you use has problems, too many print statements on command line
> etc....
> sadly it doesn't seem like they plan to fix any of it in the near future
> either.
>
> if you just need to clear your selection set you can (ssgetfirst nil nil) at
> the end of your lisp.
> hth
> mark
>
> "RolandF" wrote in message
> news:f1969ec.2@WebX.maYIadrTaRb...
> > Hallo Gary,
> >
> >
> > So please HELP me.
> >
>
>
0 Likes
Message 11 of 16

Anonymous
Not applicable
> Note to self: If you only think you know the answer, don't post. 😃
>

I disagree. The rest of the group can tell me if I need to change my
position. There have been several times where I've almost held my tongue
because it wasn't my area of expertise, but my answer then helped the person
find the rest of the answer, or triggered someone more knowledgeable to
rebut my half-truth, and thus answer the original question....

I say since it's a discussion group and not a classroom, if you think you're
reasonably close to right, fire away....
0 Likes
Message 12 of 16

Anonymous
Not applicable
Thank you, Terry.

The command can be also (sssetfirst nil).

But, is it possible to send this command without sendcommand.

Because when i do it with sendcommand i will get two lines in the commandline which maybe confuse some users.

If it is not possible, it is OK. I just want to know.

Roland
0 Likes
Message 13 of 16

Anonymous
Not applicable
I don't know of a way offhand using vba/lisp right
out of the box. You might have a look at
href="http://www.acadx.com">http://www.acadx.com
, look for
VLAX.


Kevin


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Thank
you, Terry.
The command can be also (sssetfirst nil).
But, is it
possible to send this command without sendcommand.
Because when i do it
with sendcommand i will get two lines in the commandline which maybe confuse
some users.
If it is not possible, it is OK. I just want to
know.
Roland
0 Likes
Message 14 of 16

Anonymous
Not applicable
I know AcadX, it is a great tool, would like to have it for 2004, hope it comes soon.

But i think i've got it. Here is the answer:

(defun c:CoLayCur (/) (vla-runmacro(vlax-get-acad-object) "acad.dvb!modify.CopyLayerCurrent")(sssetfirst nil)(princ))

Roland
0 Likes
Message 15 of 16

Anonymous
Not applicable
good idea Roland - thanks for sharing


Kevin


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
know AcadX, it is a great tool, would like to have it for 2004, hope it comes
soon.
But i think i've got it. Here is the answer:
(defun c:CoLayCur (/)
(vla-runmacro(vlax-get-acad-object)
"acad.dvb!modify.CopyLayerCurrent")(sssetfirst
nil)(princ))
Roland
0 Likes
Message 16 of 16

Anonymous
Not applicable

OK, i am back again. I hope that there was someone interested in this post.


No i think i know a little bit more about preselecting.



  • Do not use the PICKFIRSTSELECTIONSET if you want to use the selected items

  • Just use the SS.SelectOnScreen FilterType, FiterData

  • and use i.e. (defun c:CoLayCur (/) (vla-runmacro(vlax-get-acad-object) "acad.dvb!modify.CopyLayerCurrent"))
    for the toolbar-button


Like you see at the comments above, if you use PickfirstSelectionSet and vla-runmacro,
the previous selection will not be cleared after the command.

If you use a nomal SelectionSet you can use Filter or not, and the best, the
objects you've selected before will be deselect automatically after the command.
It's great, isn't it?


Roland

0 Likes