limfx Posted July 5 Posted July 5 Below is a collection of lisp about Entmake line type: (ent-Linetype "LINE_1" "Created by entmake" '("A" 0.7 -0.7)) "- - - - - - - - " Now I want to edit it to Entmake line type that contains text, shaped like: "- - DN - - DN - - DN - - " Hoping for help me. Thanks! (defun ent-Linetype (name description param-list) (entmake (append (list '(0 . "LTYPE") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLinetypeTableRecord") (cons 2 name) '(70 . 0) (cons 3 description) (cons 72 (ascii (nth 0 param-list))) (cons 73 (- (length param-list) 1)) (cons 40 (apply '+ (mapcar 'abs (cdr param-list))))) (apply 'append (mapcar '(lambda (x) (list (cons 49 x) '(74 . 0))) (cdr param-list)))))) Quote
BIGAL Posted July 5 Posted July 5 (edited) A linetype can be read from a .lin file no need for code. *HOT_WATER_SUPPLY,Hot water supply ---- HW ---- HW ---- HW ---- A,12.7,-5.08,["HW",STANDARD,S=2.54,R=0.0,X=-2.54,Y=-1.27],-5.08 We had custom.lin with lots of linetypes and would preload into our dwt so ready to go. Or Linetype Load 1 or more linetype into a dwg. ;load missing linetypes ;;; returns: T if loaded else nil (loadLinetype doc "Fence" "custom.lin") (loadLinetype doc "Tree" "custom.lin") (setq doc (vla-get-activedocument (vlax-get-acad-object))) ; open database (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) ) ) ) Edited July 5 by BIGAL 2 Quote
Steven P Posted July 5 Posted July 5 I thought I'd made this one up but no, to create a line type 'on the fly' I was going to create a temporary .lin file (same as writing to a text file, just save as '.lin') and load from there.... but I haven't needed that yet, not made it up yet. Quote
BIGAL Posted July 5 Posted July 5 (edited) @Steven P if you use "A" append option for a file then can add a new linetype to a "lin' file, would check 1st does name exist ? Edited July 5 by BIGAL 1 Quote
Steven P Posted July 6 Posted July 6 If I was doing that I'd also want to check that the line type name wasn't existing in the file... could be 'on the fly' is the same name but a different definition - not a big issue or one that would happen often I reckon 1 Quote
SLW210 Posted July 6 Posted July 6 I was looking for the original on Cadalyst, but this appears to be an update to that one. Make a New Linetype with Text Here is the latest on Cadalyst. There is another out there called LtFly. 2 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.