Jump to content

Recommended Posts

Posted

I often use Lee Mac's Load Linetypes code as it looks first for them in default lin files for both AutoCAD and BricsCAD then Metric or Imperial versions, then any other lin files in the support path. It also provides the option to reload the linetype if you wish. Lee's code also uses vl-cmdf in place of command-s in versions or software that doesn't support command-s. 

I keep separate lin files named for Text Styles they reference like Arial or Wingdings and this makes loading them simpler with macros that also import the Text Styles as needed.

 

Example code that should work with Metric or Imperial versions on AutoCAD or BricsCAD:

(load "LoadLinetypesV1-3.lsp")(LM:LoadLinetypes '("phantom") T)
(setq ss (ssget "_X" '((0 . "LWPOLYLINE") (67 . 1) (8 . "0") (62 . 6) (6 . "CENTER2"))))
(repeat (setq x (sslength ss))
(setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(vlax-put obj 'Linetype "Phantom")
(vlax-put obj 'LinetypeScale 0.25)
)

 

The (OR function evaluates a list of expressions only till one of them is true so if (tblsearch "ltype" "PHANTOM") is not nil (command-s "._linetype" "_load" "PHANTOM" "acad.lin" "") would not be evaluated or run in (or(tblsearch "ltype" "PHANTOM")(command-s "._linetype" "_load" "PHANTOM" "acad.lin" "")) allowing it to generally replace (IF (NOT in code.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...