Select Object/Show grips - via Code

Select Object/Show grips - via Code

Anonymous
Not applicable
1,920 Views
8 Replies
Message 1 of 9

Select Object/Show grips - via Code

Anonymous
Not applicable
Hi.

I was just wondering if anyone know how I can use VBA to select objects in
the drawing, so that the grips are enabeled/shown. The editing of the object
will be done manually in AutoCAD. All I want for VBA to do, is to select
them.

Trond Hasse Lie
Norway
0 Likes
1,921 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable
Without the aid of a third party program (perhaps Tony T's AcadX), this is
not possible from VB/VBA since the correpsonding property
(PickFirstSelectionSet) is read-only. In my attempts to use the LISP
function SSSETFIRST, the grips were cleared as soon as the VBA macro
completed.

--
Attitudes are contagious. Is yours worth catching?
http://www.acadx.com

Trond Hasse Lie wrote in message
news:817B28F9FF0CC96661FEFFA0E9C3AD8E@in.WebX.SaUCah8kaAW...
> Hi.
>
> I was just wondering if anyone know how I can use VBA to select objects in
> the drawing, so that the grips are enabeled/shown. The editing of the
object
> will be done manually in AutoCAD. All I want for VBA to do, is to select
> them.
>
> Trond Hasse Lie
> Norway
>
0 Likes
Message 3 of 9

Anonymous
Not applicable
My AcadX server, and AcadUnsupp2000 both allow you to
set Active Selection set.

Trond Hasse Lie wrote:
>
> Hi.
>
> I was just wondering if anyone know how I can use VBA to select objects in
> the drawing, so that the grips are enabeled/shown. The editing of the object
> will be done manually in AutoCAD. All I want for VBA to do, is to select
> them.
>
> Trond Hasse Lie
> Norway

--

Checkout the AcadX(tm) ActiveX Extension Library at:

http://www.caddzone.com/acadx/acadx.htm

/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://www.caddzone.com */
/*********************************************************/
0 Likes
Message 4 of 9

Anonymous
Not applicable
I have downloaded the AcadX server, read the documentation, but still can't
find out how....

Could you give me a hint?

Trond Hasse Lie
Norway

"Tony Tanzillo" wrote in message
news:3998EC4D.FBC0D9B7@worldnet.att.net...
> My AcadX server, and AcadUnsupp2000 both allow you to
> set Active Selection set.
>
> Trond Hasse Lie wrote:
> >
> > Hi.
> >
> > I was just wondering if anyone know how I can use VBA to select objects
in
> > the drawing, so that the grips are enabeled/shown. The editing of the
object
> > will be done manually in AutoCAD. All I want for VBA to do, is to select
> > them.
> >
> > Trond Hasse Lie
> > Norway
>
> --
>
> Checkout the AcadX(tm) ActiveX Extension Library at:
>
> http://www.caddzone.com/acadx/acadx.htm
>
> /*********************************************************/
> /* Tony Tanzillo Design Automation Consulting */
> /* Programming & Customization for AutoCAD & Compatibles */
> /* ----------------------------------------------------- */
> /* tony.tanzillo@worldnet.att.net */
> /* http://www.caddzone.com */
> /*********************************************************/
0 Likes
Message 5 of 9

Anonymous
Not applicable
Now I have tried acadunsupp2000, but it doen't seem like it can do the job.
I press a button in a form, and from the data in the form, a selectionset is
built.
acadunsupp2000 gave me an error when run liek a macro, but worked fine when
I "stepped" through the code. (As it say it would in the example)

So... How can it be done with the AcadX server?

Trond Hasse Lie
Norway

"Tony Tanzillo" wrote in message
news:3998EC4D.FBC0D9B7@worldnet.att.net...
> My AcadX server, and AcadUnsupp2000 both allow you to
> set Active Selection set.
>
> Trond Hasse Lie wrote:
> >
> > Hi.
> >
> > I was just wondering if anyone know how I can use VBA to select objects
in
> > the drawing, so that the grips are enabeled/shown. The editing of the
object
> > will be done manually in AutoCAD. All I want for VBA to do, is to select
> > them.
> >
> > Trond Hasse Lie
> > Norway
>
> --
>
> Checkout the AcadX(tm) ActiveX Extension Library at:
>
> http://www.caddzone.com/acadx/acadx.htm
>
> /*********************************************************/
> /* Tony Tanzillo Design Automation Consulting */
> /* Programming & Customization for AutoCAD & Compatibles */
> /* ----------------------------------------------------- */
> /* tony.tanzillo@worldnet.att.net */
> /* http://www.caddzone.com */
> /*********************************************************/
0 Likes
Message 6 of 9

Anonymous
Not applicable
Regardless of whether you're using AcadX or AdskUnsupp2000,
you cannot set the ActiveSelectionSet from a VBA macro that
is executed via the VBARUN command. The reason is because
the VBARUN command clears the active selection set when it
terminates.

You can only set the active selection set from a modeless
ActiveX client (in or out of process), and only while there
is no command active.

Trond Hasse Lie wrote:
>
> Now I have tried acadunsupp2000, but it doen't seem like it can do the job.
> I press a button in a form, and from the data in the form, a selectionset is
> built.
> acadunsupp2000 gave me an error when run liek a macro, but worked fine when
> I "stepped" through the code. (As it say it would in the example)
>
> So... How can it be done with the AcadX server?
>

--

Checkout the AcadX(tm) ActiveX Extension Library at:

http://www.caddzone.com/acadx/acadx.htm

/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://www.caddzone.com */
/*********************************************************/
0 Likes
Message 7 of 9

matteo_trasi_formamentis_it
Contributor
Contributor
Sure you can. You can find examples on http://www.abccorsicad.it/software_autocad.html You have to call SELECT command in AutoCAD from VBA and then pass handles as parameters Try this to put grips on all lines in the drawing: Public Sub test() Dim c As Collection, obj As AcadEntity Set c = New Collection For Each obj In ThisDrawing.ModelSpace If TypeOf obj Is AcadLine Then c.Add obj End If Next SetSelection c End Sub Private Sub SetSelection(objs As Collection) Dim obj If ThisDrawing.PickfirstSelectionSet.Count > 0 Then 'just send any command to remove grips ThisDrawing.SendCommand Chr(27) End If ThisDrawing.SendCommand "_SELECT" & Chr(13) For Each obj In objs ThisDrawing.SendCommand "(handent """ & obj.Handle & """)" & vbCr Next ThisDrawing.SendCommand vbCr End Sub
Message 8 of 9

Anonymous
Not applicable

Matteo,

 

That's fantastic! I could never work out how to do this.

It massively increases the user-friendlyness of some of my macros.

 

Many thanks,

 

T

0 Likes
Message 9 of 9

matteo_trasi_formamentis_it
Contributor
Contributor

Tank you! Happy to help you.

0 Likes