TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: dussla on March 31, 2022, 11:54:06 PM
-
hi
i made this code
that code is rotate code with number
but result is some error
what problem ?
(prompt "\nRotate Copy or Move") tmp 0.0
)
(setq ang
( / 360 angPER
))
)
)
EDIT (John): Added code tags.
-
What error do you get ? If you just press Enter (and not type a value) angper will be NIL and then your calculation doesn't work.
Mathias
-
What error do you get ? If you just press Enter (and not type a value) angper will be NIL and then your calculation doesn't work.
Mathias
Can you see the dwg file?
If you rotate
Does not rotate to the correct angle
For example, if you enter 7
the result is weird
-
What error do you get ? If you just press Enter (and not type a value) angper will be NIL and then your calculation doesn't work.
Mathias
Can you see the dwg file?
If you rotate
Does not rotate to the correct angle
For example, if you enter 7
the result is weird
Cnsider using reals instead if integers for calculation!!!
-
What error do you get ? If you just press Enter (and not type a value) angper will be NIL and then your calculation doesn't work.
Mathias
Can you see the dwg file?
If you rotate
Does not rotate to the correct angle
For example, if you enter 7
the result is weird
Cnsider using reals instead if integers for calculation!!!
Really thank you
Work good
-
A few things to consider:
- Store the value of all system variables before making any changes, and reset them to their original values, rather than assuming that CMDECHO should be set to 1
- Consider the effect of any active Object Snap modes when supplying the base point to the ROTATE command - you can use the "_non" modifier to ignore all active snaps prior to the point input
- Consider the possibility that the user may not supply a valid selection, point, or number and use a conditional statement (if/cond) to branch accordingly
- The value of the 'default' variable tmp will never be assigned to the variable angPer even if the user presses ENTER
- Consider that the division of two integers will always yield an integer in AutoLISP
- Use a final (princ) or (prin1) expression as the last expression in the function definition to return a null symbol (i.e. a 'clean' output) to the command line, rather than the value returned by the repeat expression
- Declare the variables that are local to your function to avoid symbols clashing in the document namespace