Grrr Posted December 31, 2015 Posted December 31, 2015 Hello everyone! I don't understand why I'm getting this error, when I'm trying to incorporate the IF function. Command: TEST Error: bad argument type: VLA-OBJECT nil ;; ;;D:\Program Files\Autodesk\AutoCAD 2015\Fonts - path for ACAD .shx files ;;D:\Fonts\ - My path ;;C:\Windows\Fonts - path for windows .ttf files ;; Optional: Make the new style Active ;;(vla-put-activetextstyle acadDoc objStyle) (defun c:test () (vl-load-com) (setq acadApp (vlax-get-Acad-object)) (setq acadDoc (vla-get-ActiveDocument acadApp)) (setq styles (vla-get-textstyles acadDoc)) ;; Add the style named: (setq st-name "VLD_simplex") (if (not (tblsearch "STYLE" st-name)) ( (setq objStyle (vla-add styles st-name)) ;; Assign fontfile to the style: (setq ff "D:\\Program Files\\Autodesk\\AutoCAD 2015\\Fonts\\simplex8.shx") ;fontfile path here (vla-put-fontfile objStyle ff) );then (princ (strcat "\n " st-name " style already defined!" ));else );if (princ) ) Quote
BIGAL Posted December 31, 2015 Posted December 31, 2015 You may need a progn in the if my version (if (= (tblsearch "STYLE" st-name) nil) (progn (setq objStyle (vla-add styles st-name)) ;; Assign fontfile to the style: (setq ff "D:\\Program Files\\Autodesk\\AutoCAD 2015\\Fonts\\simplex8.shx") ;fontfile path here (vla-put-fontfile objStyle ff) ); progn (princ (strcat "\n " st-name " style already defined!" ));else );if Quote
Grrr Posted December 31, 2015 Author Posted December 31, 2015 Thank you, BIGAL! I solved it myself little bit earlier - still learning new functions, in my first time error handling experience. Also I'm trying to transition more into VLA (its a pain in the a**). Happy New Year! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.