Simple Lisp Routine to Insert, Scale, and Rotate with exisitng point variables

Simple Lisp Routine to Insert, Scale, and Rotate with exisitng point variables

anthonyalessi86
Explorer Explorer
3,171 Views
6 Replies
Message 1 of 7

Simple Lisp Routine to Insert, Scale, and Rotate with exisitng point variables

anthonyalessi86
Explorer
Explorer

I am new to writing lisp routines but seem to be having the most trouble simply inserting, scaling and rotating a block as I would when not using lisp.

I have two point variables and I would like to insert the block "Dpp" at point variable P1 , scale to variable SCL, and rotate to angle variable Ang1.

I simply can't get the correct order of instructions to get this done.

I know this is a remedial problem for the experts in this forum but any help anyone could offer would be greatly appreciated.

Thanks in advance.

0 Likes
Accepted solutions (1)
3,172 Views
6 Replies
Replies (6)
Message 2 of 7

hmsilva
Mentor
Mentor

Welcome to the Autodesk Discussion Community, anthonyalessi86!

 

The best place to get help with Auto/Visual LISP doubts, is at the Visual LISP, AutoLISP and General Customization forum...

 

To solve the insertion problem, try

 

(command "_.-insert" Dpp "_S" SCL "_R" Ang1 p1)

 

Hope that helps, good luck

Henrique

EESignature

0 Likes
Message 3 of 7

Kent1Cooper
Consultant
Consultant

@anthonyalessi86 wrote:

....

I have two point variables and I would like to insert the block "Dpp" at point variable P1 , scale to variable SCL, and rotate to angle variable Ang1.

I simply can't get the correct order of instructions to get this done.

....


The order would be exactly as you would give it responses when doing it manually.  If you post what you tried, someone may be able to see what wasn't right -- maybe just not putting quotes around an entry that requires them, or vice versa.  Another way:

 

(command "_.insert" "Dpp" P1 SCL "" Ang1)

 

Slightly shorter than hmsilva's suggestion, because giving it the insertion point and scale and rotation where the Insert command naturally asks for them avoids the need to add option letter entries to specify them in a different order.  But it does take one more entry for the default Y scale factor, as compared to using the Scale option which uses whatever is given for all scale factors so you don't need to give it both X and Y.

Kent Cooper, AIA
0 Likes
Message 4 of 7

anthonyalessi86
Explorer
Explorer
Accepted solution

Thanks hmsilva & Kent1Cooper for your help, however I'm not quite there yet...

The routine is installing the block at the correct location & scale but does not seem to be accepting the rotational angle.

It seems to be inserting at the default <0>.

I have even included the RTD sub-routine to make sure this entry was in degrees not radians.

Any thoughts....anyone?

Again, thanks in advance.

0 Likes
Message 5 of 7

anthonyalessi86
Explorer
Explorer
I have it working now.
FYI. I removed the "" between SCL & Ang1 in the following line:
(command "_.insert" "Dpp" P1 SCL "" Ang1)
It's working perfectly. Thanks!
0 Likes
Message 6 of 7

Kent1Cooper
Consultant
Consultant

@anthonyalessi86 wrote:
....
FYI. I removed the "" between SCL & Ang1 in the following line:
(command "_.insert" "Dpp" P1 SCL "" Ang1)
....

I keep forgetting about the option in newer releases to define a Block so that it can only be inserted with uniform scales.  That kind of Block would require only one scale entry.  The extra "" would be appropriate for a Block that allows unequal scale factors.

Kent Cooper, AIA
0 Likes
Message 7 of 7

hmsilva
Mentor
Mentor

@Kent1Cooper wrote:

I keep forgetting about the option in newer releases to define a Block so that it can only be inserted with uniform scales.  That kind of Block would require only one scale entry.  The extra "" would be appropriate for a Block that allows unequal scale factors.


That's why I have suggested this prompt sequence

(command "_.-insert" "Dpp" "_S" SCL "_R" Ang1 p1)

 it should work as expected with uniform and non-uniform scale blocks.

 

Henrique

EESignature

0 Likes