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

Select Object/Show grips - via Code

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
1165 Views, 8 Replies

Select Object/Show grips - via Code

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
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: Anonymous

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
>
Message 3 of 9
Anonymous
in reply to: Anonymous

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 */
/*********************************************************/
Message 4 of 9
Anonymous
in reply to: Anonymous

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 */
> /*********************************************************/
Message 5 of 9
Anonymous
in reply to: Anonymous

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 */
> /*********************************************************/
Message 6 of 9
Anonymous
in reply to: Anonymous

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 */
/*********************************************************/
Message 7 of 9
matteo.trasi
in reply to: Anonymous

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
Tags (1)
Message 8 of 9
tes-twelve
in reply to: matteo.trasi

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

Message 9 of 9
matteo.trasi
in reply to: tes-twelve

Tank you! Happy to help you.

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

Post to forums  

Autodesk Design & Make Report

”Boost