Can LISP Skip a Line of Code, Then Come Back To It?

Can LISP Skip a Line of Code, Then Come Back To It?

Anonymous
Not applicable
1,217 Views
4 Replies
Message 1 of 5

Can LISP Skip a Line of Code, Then Come Back To It?

Anonymous
Not applicable

I wrote a LISP program that creates Mtext based on multiple inputs from the user.  For some reason this program is a bit slow, so I added a prompt - right after the line that asks the user to pick a point to place the Mtext - that says, "Creating Mtext....  Please wait...."  The odd thing is, the program actually creates the Mtext right away, then there is a long pause, THEN the prompt appears, which of course by now is pointless.  How is this possible?

 

Attached is the LISP program, Calculate Inverts.lsp, with the prompt in question near the end of the Input section. We're still using Land Desktop 2005, not Civil 3D, in case you're wondering why I wrote this.

 

0 Likes
Accepted solutions (1)
1,218 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

Sorry, the question in the title is poorly worded.  It must be the PC or AutoCAD that processes data going to the graphics screen separately from data going to the command prompt.  The graphics screen must get priority. The result just looks odd.

0 Likes
Message 3 of 5

ВeekeeCZ
Consultant
Consultant
Accepted solution

Just one tip...

 

(foreach n llist-f (command "-layer" "f" n ""))

 

This is very slow. Not sure how long list of layers you have, but you use this expression many times.
Build a long string of layers delimited by ",", then use the command just for one time.

 

(command "-layer" "f" "Layer1,Layer2,Layer3" "")

Message 4 of 5

paullimapa
Mentor
Mentor

BeekeeCZ makes an excellent suggestion.

But I think AutoCAD still has a 256 characters maximum command input length so you'll have to test to make sure the string of layer names are shorter than 256.  Once the length is longer, then you'll have to start a new string.

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales | Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 5 of 5

Anonymous
Not applicable

Thanks for the tip!  There are 875 layers in this dwg, so the layer command must be what's slowing down the program.  I may just remove this line and warn the user in the notes to thaw and turn on the required layers.

0 Likes