SELECT works interactively and doesn't work from a script

SELECT works interactively and doesn't work from a script

dmitriZTSCC
Contributor Contributor
898 Views
5 Replies
Message 1 of 6

SELECT works interactively and doesn't work from a script

dmitriZTSCC
Contributor
Contributor

I need to make a closed polyline and extrude it.

In interactive mode, I just make a PLINE and then call EXTRUDE and it just works.

When writing those same commands to a script, the line isn't selected after it's added (closed). So, I'm trying to do everything to actually select the line and nothing is working.

My intuition is that I should wither SELECT or DESELECT-SELECT (I've tried both) the line and then call EXTRUDE or, alternatively, call EXTRUDE and then specify the co-ordinates of the line to extrude.

When I do it interactively, it works just fine. I can provide the co-ordinates to SELECT and it tells me that 1 object is selected, so I can confidently call EXTRUDE.

When running a script, I call SELECT and it doesn't find the object! Instead, even though I'm providing valid co-ordinates, it cannot find anything and asks me to provide a closing bound to search for objects. I've tried both this as well as calling EXTRUDE and specifying the co-ordinates of the line to extrude and it cannot find that line, even though I 100% know the line is there and can select it with SELECT in interactive mode just by typing those same commands that I have in my script.

Can someone help me figure out what's going on here? This is very infuriating.

0 Likes
Accepted solutions (1)
899 Views
5 Replies
Replies (5)
Message 2 of 6

pendean
Community Legend
Community Legend
Post the content of your script here please, let us see what all you are trying to accomplish with it.

0 Likes
Message 3 of 6

David_W_Koch
Mentor
Mentor

When I close a polyline, the command ends, but the polyline is not selected.

 

Be that as it may, in your script, are you creating the polyline and then immediately calling the EXTRUDE command?  If so, at the first prompt (Select objects to extrude...), have your script respond with L.  That will select the last object created, which would be your polyline.  Add another ENTER (blank line) to end the selection of objects, then proceed to provide the height, or select one of the command-line options, etc.


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

0 Likes
Message 4 of 6

David_W_Koch
Mentor
Mentor
Accepted solution

The attached file works to create a polyline and then extrude it.  If this is not what you are trying to do, then, as @pendean requested, sharing your script would be helpful.

 

You will have to change the file extension from TXT to SCR for it to work as a script in AutoCAD.  I was not allowed to attach the file with the SCR extension.  (Make certain that you have the display of file extensions for known file types turned on in Windows - it is turned off by default - so that you do not end up with a file called PLINE-EXTRUDE.scr.txt, which AutoCAD will not recognize as a script file.)


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

0 Likes
Message 5 of 6

dmitriZTSCC
Contributor
Contributor

Thanks, this approach appears to work.

It doesn't answer the question of how you would extrude the lines post-hoc (several steps after they've been created), but this approach is good enough for me for the moment.

0 Likes
Message 6 of 6

David_W_Koch
Mentor
Mentor

If you are using AutoCAD Architecture, or at the least the full version of AutoCAD (not LT), you can make use of AutoLISP expressions in your script to assign a selection set to a variable that would then be available for use at a later time in the script, after other element have been created.


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

0 Likes