shadow
Computer
- Mar 1, 2001
- 321
Wow just relized how many posts was in An Autolisp Lesson part 2's thread
any way
a recap
(setq linelength (rtos linelength 4 8))
RTOS converts length into text string thats what it does
Then we learned about getting the drawing name and path using the following
setq MYPATH (getvar "dwgprefix")
I do not recall if it comes with a slash or without.
If slash missing, add it thus:
(setq MYPATH (strcat MYPATH "/")
try on command line till it works right - "/" or "\\" or else.
Then attach dwgname to this path.
(setq MYPATH (strcat MYPATH (getvar "dwgname"))
and how to use the prin(t)(c)(1) functions
(princ ", " f) ;puts a comma and a space on the same line
(princ "\n, " f) ;the same on a new line - never needed I suppose but to illustrate the use of \n
(print ", " f) ; the same on a new line but with quotations
(prin1 ", " f) ; used to do something - I forgot.
then we leearned about how to remove the extention from the drawing name to use as a name for a txt file using the following
(setq DWGNAME (getvar "DWGNAME")
(setq NAME (substr DWGNAME 1 (- (strlen DWGNAME) 4)))
& we learned that possibly lisp cannot read the clipboard
now another ???
Conditional Rotation
back to the linelength.lsp
how do you go about telling the lisp to get the rotation angle of the line and if it is an angle between0-45 degrees then textangle should be at an angle opposit of that angle so inother words if the line comes out 45d then the text should be -45d or 315d
i would assume the latter would end up a variable that would be placed in the area where the followig is
(COMMAND "_.text" "_j" "mc"midpoint angledegree linelength)
with the variable txtang being the rotation angle for the text to be inserted right
So i guess the best place to start would be explaining what is being done on the following lines
;10 get the inclination
(setq angleradian (angle starting ending))
(setq angledegree (/ (* angleradian 180. 7. ) 22.))
i understand the first its getting the angle between the starting and ending poins collected in the selection set but what does the other do
if everyone helps everybody the world will be a better place
any way
a recap
(setq linelength (rtos linelength 4 8))
RTOS converts length into text string thats what it does
Then we learned about getting the drawing name and path using the following
setq MYPATH (getvar "dwgprefix")
I do not recall if it comes with a slash or without.
If slash missing, add it thus:
(setq MYPATH (strcat MYPATH "/")
try on command line till it works right - "/" or "\\" or else.
Then attach dwgname to this path.
(setq MYPATH (strcat MYPATH (getvar "dwgname"))
and how to use the prin(t)(c)(1) functions
(princ ", " f) ;puts a comma and a space on the same line
(princ "\n, " f) ;the same on a new line - never needed I suppose but to illustrate the use of \n
(print ", " f) ; the same on a new line but with quotations
(prin1 ", " f) ; used to do something - I forgot.
then we leearned about how to remove the extention from the drawing name to use as a name for a txt file using the following
(setq DWGNAME (getvar "DWGNAME")
(setq NAME (substr DWGNAME 1 (- (strlen DWGNAME) 4)))
& we learned that possibly lisp cannot read the clipboard
now another ???
Conditional Rotation
back to the linelength.lsp
how do you go about telling the lisp to get the rotation angle of the line and if it is an angle between0-45 degrees then textangle should be at an angle opposit of that angle so inother words if the line comes out 45d then the text should be -45d or 315d
i would assume the latter would end up a variable that would be placed in the area where the followig is
(COMMAND "_.text" "_j" "mc"midpoint angledegree linelength)
with the variable txtang being the rotation angle for the text to be inserted right
So i guess the best place to start would be explaining what is being done on the following lines
;10 get the inclination
(setq angleradian (angle starting ending))
(setq angledegree (/ (* angleradian 180. 7. ) 22.))
i understand the first its getting the angle between the starting and ending poins collected in the selection set but what does the other do
if everyone helps everybody the world will be a better place