TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: HofCAD on March 31, 2015, 05:57:47 AM
-
Dear Readers,
Why is it impossible in a regular AutoCAD to specify the LineWeight as a string?
Because it is possible in educational version of AutoCAD!
(vla-put-Lineweight NewLayer 18) versus (vla-put-Lineweight NewLayer "0.18")
Regards.
(defun c:Test1 ();Works in regular AutoCAD and educational AutoCAD
(vl-load-com)
(setq doc (vla-get-ActiveDocument
(vlax-get-Acad-Object)
)
)
(setq LayerCollection (vla-Get-Layers doc))
(setq NewLayer (vla-add LayerCollection "Layer1"))
(vla-put-color NewLayer "4")
(if (not (tblobjname "ltype" "CENTER"))
(vla-load (vla-Get-Linetypes doc) "CENTER" "acadiso.lin")
)
(vla-put-linetype NewLayer "CENTER")
(vla-put-Lineweight NewLayer 18) ; ADD A lineweight.
)
(defun c:Test2 ();Works only in educational AutoCAD
(vl-load-com)
(setq doc (vla-get-ActiveDocument
(vlax-get-Acad-Object)
)
)
(setq LayerCollection (vla-Get-Layers doc))
(setq NewLayer (vla-add LayerCollection "Layer2"))
(vla-put-color NewLayer "4")
(if (not (tblobjname "ltype" "CENTER"))
(vla-load (vla-Get-Linetypes doc) "CENTER" "acadiso.lin")
)
(vla-put-linetype NewLayer "CENTER")
(vla-put-Lineweight NewLayer "0.18") ; ADD A lineweight.
)
-
vla-put-lineweight must be an integer along with matching the following
-3 (ByLwDeafault)
-2 (ByBlock)
-1 (ByLayer)
0, 5, 9, 13, 15, 18, 20, 25, 30, 35, 40, 50, 53, 60, 70, 80, 90, 100, 106, 120, 140, 158, 200, 211
18 =/= ".18"
http://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-ActiveX/files/GUID-DE1AC635-BCEA-428F-A47D-80E35EFE55D3-htm.html
Educational version may work however it could be setting the value to LWDEFAULT instead of .18
-
vla-put-lineweight must be an integer along with matching the following
-3 (ByLwDeafault)
-2 (ByBlock)
-1 (ByLayer)
0, 5, 9, 13, 15, 18, 20, 25, 30, 35, 40, 50, 53, 60, 70, 80, 90, 100, 106, 120, 140, 158, 200, 211
18 =/= ".18"
http://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-ActiveX/files/GUID-DE1AC635-BCEA-428F-A47D-80E35EFE55D3-htm.html
Educational version may work however it could be setting the value to LWDEFAULT instead of .18
Dear Chris,
Thanks, but ".18" does not work in regular AutoCAD, because I get 0.00!
(see Test3 in Attachment)
Regards
-
In AutoCAD 2016 both of these work:
-
In AutoCAD 2016 both of these work:
Do you get the same result?
-
In AutoCAD 2016 both of these work:
If I recall, this 'leniency' also applies to the height argument for the addtext method.
-
In AutoCAD 2016 both of these work:
Do you get the same result?
Yup.
-
In AutoCAD 2016 both of these work:
If I recall, this 'leniency' also applies to the height argument for the addtext method.
Why AUTODESK has given this leniency here only ?
Why not this leniency at all other places ?
-
In AutoCAD 2016 both of these work:
If I recall, this 'leniency' also applies to the height argument for the addtext method.
Why AUTODESK has given this leniency here only ?
Why not this leniency at all other places ?
Personally, I would prefer that the leniency were not present at all, and that the functions performed exactly as stated in the documentation - I don't like surprises :-P
-
Seems odd that it allows an integer or string. What happens if you pass a text string? You'd have to include addition error trapping to only allow numerical strings to pass.
Obviously (vla-put-lineweight newlayer "Text") isn't possible.