VBA - LIST COMMAND

VBA - LIST COMMAND

Anonymous
Not applicable
2,737 Views
15 Replies
Message 1 of 16

VBA - LIST COMMAND

Anonymous
Not applicable
Is there a VBA equivalent to the LIST command in autoCAD?

Liz
0 Likes
2,738 Views
15 Replies
Replies (15)
Message 2 of 16

Anonymous
Not applicable
Have you considered using SendCommand ?? You could pass it "List" and the entity handle.

Andrew
0 Likes
Message 3 of 16

Anonymous
Not applicable
I'm actually trying to do the opposite. I'm creating a program that runs through each object and exports the data to excel. So i'm trying to access the LIST command data in another way.
0 Likes
Message 4 of 16

dgorsman
Consultant
Consultant
Why not access the properties directly, such as obj.Layer, obj.Center, and so on?
----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 5 of 16

Anonymous
Not applicable
i agree with dgorsman, if know all of the object types you can access their properties. otherwise maybe you could log the command window and then access the logged file to get results from the sendcommand list.
0 Likes
Message 6 of 16

Anonymous
Not applicable
I am doing that for the AutoCAD objects. But I am also trying to do this with objects created in Bentley AutoPLANT. The call commands are different for those objects and are proving difficult. That method is leading me in a direction I don't like, and LIST still provides all the useful information. there is an issue regarding the handle of the objects when I try using the AutoPLANT references. I would prefer to use a routine similar to LIST.

Another thought: Does anyone know how to see the code behind the list command?
0 Likes
Message 7 of 16

Anonymous
Not applicable
that would be a useful routine to cycle through an unknown object's properties and methods...you'd think there'd be a way... if all else fails maybe set the logfile on and set the command echo off and run the list command and search backward through the log file for the last issued list command and its all string manipulation from there.. maybe useful too is the lisp (entget(car(entsel))) for dxf codes as gary recently posted

hth


Message was edited by: cadger Message was edited by: cadger
0 Likes
Message 8 of 16

dgorsman
Consultant
Consultant
If there isn't a COM interface available for the AutoPLANT objects (I think there is one for the structural part), you are probably SOL. It uses custom, non-AutoCAD objects with their own set of properties. You might make better progress reading off the project database.
----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 9 of 16

Anonymous
Not applicable
How can I do that? - sorry still kinda green at this
0 Likes
Message 10 of 16

dgorsman
Consultant
Consultant
Try asking and searching over in the ADO/Connectivity group - this is their bread-and-butter. Pulling stuff from a database is not for the faint of heart, and will require up-front planning before any code is written.
----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 11 of 16

Anonymous
Not applicable
ok then lets backtrack a sec. How can I send a handle to the list command? I'm thinking if i sort through the objects for each object run the command and send the current handle to it. Then extract the information from the command box as we discussed.
0 Likes
Message 12 of 16

Anonymous
Not applicable
Hi,In AutoCAD rum VBAIDE. Create an empty project. Go to Extras - Add
references, select the file ps3d_com.arx in the Prg folder. Paste the
following lines and store the macro.Forget using LIST for the AutoPLANT
structural elements - using this COM interface can give you all information
you need.As long as you dont know which AutoPLANT structural entity you are
using it is the best way to make use of Ks_ComProperty.Run the macro using
F5! Make yourself familiar with VBA, it can be used easier than Lisp. And
from this it is only a small step to VB.NET to create professional
applications!DominikSub Example_ReadFrom() Dim Result As Long
Dim Entity As AcadEntity Dim Selection As Ks_ComSelection Dim Prop As
Ks_ComProperty Set Selection = New Ks_ComSelection Set Prop = New
Ks_ComProperty Set Entity = Selection.PickObject(vbCrLf & "Select
object: ", Result) Prop.ReadFrom Entity
ThisDrawing.Utility.Prompt vbCrLf & Prop.Name ThisDrawing.Utility.Prompt
vbCrLf & Prop.InternalName Prop.Note1 = "Note 1" Prop.Note2 =
"Note 2" Prop.WriteTo Entity ThisDrawing.Utility.Prompt vbCrLf
& Prop.Name ThisDrawing.Utility.Prompt vbCrLf & Prop.Note1
ThisDrawing.Utility.Prompt vbCrLf & Prop.Note2 End Sub
schrieb im Newsbeitrag news:5977465@discussion.autodesk.com...
ok then lets backtrack a sec. How can I send a handle to the list command?
I'm thinking if i sort through the objects for each object run the command
and send the current handle to it. Then extract the information from the
command box as we discussed.
0 Likes
Message 13 of 16

Anonymous
Not applicable
When you are building your command text string to pass to SendCommand, and you get to the part of the command that wants an entity to be selected, do somehting like this:

strCommand = strCommand & "(handent """ & ent.Handle & """)" & vbCr

Regards

Andrew
0 Likes
Message 14 of 16

Anonymous
Not applicable
Perhaps this example might help point you in the right direction?

Joe ...


wrote in message news:5977465@discussion.autodesk.com...
ok then lets backtrack a sec. How can I send a handle to the list command?
I'm thinking if i sort through the objects for each object run the command
and send the current handle to it. Then extract the information from the
command box as we discussed.
0 Likes
Message 15 of 16

Anonymous
Not applicable
Ok I think there is enough to work with here. Thanks for all your help guys!
0 Likes
Message 16 of 16

Anonymous
Not applicable
Hai
Loop through all the entites inthe drawing to get list of objects from drawing
0 Likes