sending comands to the command line

sending comands to the command line

Anonymous
Not applicable
575 Views
5 Replies
Message 1 of 6

sending comands to the command line

Anonymous
Not applicable
Hello everyone,

I have been trying to teach myself VBA for the past couple weeks. I am very familiar with Visual lisp. One thing I have noticed about VBA is you can not run commands from autocad as easy as you can with lisp (at least for me). What I am trying to do is use the sweep command to draw Pipe profile at 0,0,0 and loop to place a pipe on each line that i have in a selection set. I noticed that VBA does not have a Sweep command in the there object browser, so I tried to do this ThisDrawing.SendCommand "sweep" & vbCr & "object" & vbCr & "path" & vbCr & vbCr. The variable "Object" is the pipe drawn @ 0,0,0 and "path" is the line that i want to sweep on. I am guessing that this didn't work because the command line does not reconize the variables Object and Path. Does anyone know how i can get around this. Is there any way to run the sweep command and use the variables that i have set. Any help is much appreciated


Also I do not think that extrude on a path will work, because the pipe needs to always be drawn at 0,0,0 and i will never know where the line will be in the drawing.
0 Likes
576 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
heres where your knowlege of lisp can come in handy.

You can send the "Object" to the command line by sending the Handle to the object, and embedding the "handent" command in there ..

First, get the handle to the object you need to pass on the command line.. Im not sure what the "pipe" is, but get the pipe, either thru code , or selection onscreen, and use the Object.Handle to get its handle. - ie:

Dim PipeHandle as string
PipeHandle =Object.Handle ' "Object" is whatever geometry type it is: polyline, etc


Then, pass the handle of the object in the command line like so:
"sweep" & vbCr & "(handent " & PipeHandle & ")" & vbCr & "path" & vbCr & vbCr
0 Likes
Message 3 of 6

Anonymous
Not applicable
this really helps i will give it a shot. thanks alot
0 Likes
Message 4 of 6

Anonymous
Not applicable
This is what i typed in for my code.

PipeHandle = Object.Handle
PathHandle = Path.Handle
ThisDrawing.SendCommand "sweep" & vbCr & "(handent " & PipeHandle & ")" & vbCr & "(handent " & PathHandle & ")" & vbCr & vbCr


This is what was returned in the command line. Any suggestions to what i might have done wrong.


Command: sweep
Current wire frame density: ISOLINES=1
Select objects to sweep: (handent 437A3)
; error: bad argument type: stringp nil
Select objects to sweep: (handent 437A3)
; error: bad argument type: stringp nil
Select objects to sweep:
Nothing selected.
0 Likes
Message 5 of 6

Anonymous
Not applicable
>>This is what i typed in for my code.
>>
>>PipeHandle = Object.Handle
>>PathHandle = Path.Handle
>>ThisDrawing.SendCommand "sweep" & vbCr & "(handent " & PipeHandle & ")" & vbCr & "(handent " & PathHandle & ")" & vbCr & vbCr


again, there are no such acad entities as "Object" and "Path". You have to select them somehow, using the mouse, or code. Once you select them, you can store them in VARIABLES named "Pipe" or "Path" (I know "Object" is a reserved word and cannot be used, and maybe "Path" is reserved, as well)
0 Likes
Message 6 of 6

Anonymous
Not applicable
I got it to work thank you for your help.
0 Likes