TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: MeasureUp on December 22, 2010, 06:32:28 PM
-
There is no problems when changing linetype scale by selecting object on the screen.
command: chprop -> select object -> "s"
But this won't work when writing to the code.
For example, I want to change the selected object to
1) Layer: steel
2) Linetype Scale: 0.5
And the following is what I get.
(command "._chprop" "last" "" "layer" "Steel" "" "S" "0.5")
Command: ._chprop
Select objects: last 1 found
Select objects:
Enter property to change
[Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
layer
Enter new layer name <Dims>: Steel
Enter property to change
[Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
Command: S Unknown command "S". Press F1 for help.
Command: 0.5 Unknown command "5". Press F1 for help.
Does anyone has a solution?
Thanks for your help.
-
Move the quotes between "Steel" and "S" to the end:
(command "._chprop" "last" "" "layer" "Steel" "S" "0.5" "")
-
Move the quotes between "Steel" and "S" to the end:
(command "._chprop" "last" "" "layer" "Steel" "S" "0.5" "")
That is it.
Thank you very much & merry Christmas.
-
Should you want to approach it another way :-)
(defun c:test ( / ss i )
(if (setq ss (ssget "_L"))
(repeat (setq i (sslength ss))
(entupd
(cdr
(assoc -1
(_UpdateDXF 48 0.5
(_UpdateDXF 8 "Steel"
(entget (ssname ss (setq i (1- i))))
)
)
)
)
)
)
)
(princ)
)
(defun _UpdateDXF ( code value elist )
(cond ( (entmod (list (assoc -1 elist) (cons code value))) ) ( elist ))
)
Merry Christmas guys! :-)
-
Do you find inconsistencies in using entmod that way? I tried it a few weeks back, but it didn't work on LWPolylines and randomly didn't work on Lines.
Also, you shouldn't need to step through the selection set since (ssget "_L") will only select the last object - (ssname ss 0) should suffice, or am I just wrong?
-
Do you find inconsistencies in using entmod that way? I tried it a few weeks back, but it didn't work on LWPolylines and randomly didn't work on Lines.
I've found it works in most cases, but not when updating MText formatting, or on non-graphical entities such as layers etc.
Also, you shouldn't need to step through the selection set since (ssget "_L") will only select the last object - (ssname ss 0) should suffice, or am I just wrong?
Good point, I think does only collect one entity - oh well, at least its open for easy modification should the user want to change it :-)
-
Do you find inconsistencies in using entmod that way? I tried it a few weeks back, but it didn't work on LWPolylines and randomly didn't work on Lines.
I've found it works in most cases, but not when updating MText formatting, or on non-graphical entities such as layers etc.
Well, not working on LWPolylines and sometimes on Lines is enough for me to not use it. I was curious if it was only me or you had similar results.