robierzo Posted March 8 Posted March 8 Hello. How can I check if the line type "TRAZOS" is loaded? And if it is not charged, how can I charge it? Thank you Quote
Steven P Posted March 8 Posted March 8 (edited) Something like this: Linetype is the line name "TRAZOS" (I don't think it i case sensitive) acad.lin is the line definition file that the line type is described in - you might need to find out what that is and replace the text below assumes here that the file 'acad.lin' is in trusted files location (defun MakeLoadLines ( linetype / ) (if (tblsearch "LTYPE" linetype) ;;Check if linetype is loaded (command ".-linetype" "_Load" linetype "acad.lin" "_Yes" "") ;; reload it anyway. Replace with (progn ) for no reloading (command ".-linetype" "_Load" linetype "acad.lin" "") ;; otherwise load it ) (princ) ) Edited March 8 by Steven P 2 Quote
BIGAL Posted March 10 Posted March 10 We have Custom.lin, MCC-Services.lin, DRAINPIPE.LIN, plus more custom linetypes. Just type "linetype" and look it shows what is loaded, select another file and can choose "TRAZOS". Side note yes can load linetype "TRAZOS" from a custom.lin file if its not already loaded. (defun loadLinetype (doc LineTypeName FileName) (if (and (not (existLinetype doc LineTypeName)) (vl-catch-all-error-p (vl-catch-all-apply 'vla-load (list (vla-get-Linetypes doc) LineTypeName FileName ) ) ) ) nil T ) ) (defun existLinetype (doc LineTypeName / item loaded) (vlax-for item (vla-get-linetypes doc) (if (= (strcase (vla-get-name item)) (strcase LineTypeName)) (setq loaded T) ) ) ) (setq doc (vla-get-activedocument (vlax-get-acad-object))) ; open database ;load missing linetypes ;;; returns: T if loaded else nil (loadLinetype doc "Fence" "custom.lin") (loadLinetype doc "Tree" "custom.lin") 1 Quote
dexus Posted March 11 Posted March 11 I noticed a small mistake in the existLineType function. It only returns true if the last found linetype is the one you are looking for, but if you change it to this it should work as expected: (defun existLinetype (doc LineTypeName / item loaded) (vlax-for item (vla-get-linetypes doc) (if (= (strcase (vla-get-name item)) (strcase LineTypeName)) (setq loaded T) ) ) loaded ) 1 Quote
BIGAL Posted March 11 Posted March 11 The code is cut from a big program so loaded is checked further down in the code no need for extra "loaded" it returns T or nil. 1 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.