Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why can't I entmake a linetype definition?

7 REPLIES 7
Reply
Message 1 of 8
anim8er3
781 Views, 7 Replies

Why can't I entmake a linetype definition?

I tried to use this code to entmake a linetype definition. Why didn't it work?

 

(if (= (tblobjname "LTYPE" "PHANTOM2") nil)
(entmake (list '(0 . "LTYPE") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLinetypeTableRecord") '(2 . "PHANTOM2") '(70 . 0)
'(3 . "Phantom \(.5x\) ___ _ _ ___ _ _ ___ _ _ ___ _ _") '(72 . 65) '(73 . 6) '(40 . 1.25)
'(49 . 0.625) '(49 . -0.125) '(49 . 0.125) '(49 . -0.125) '(49 . 0.125) '(49 . -0.125) '(74 . 0))))

 

7 REPLIES 7
Message 2 of 8
dbroad
in reply to: anim8er3

Change entmake to entmakex

Architect, Registered NC, VA, SC, & GA.
Message 3 of 8
anim8er3
in reply to: dbroad

It didn't work. NIL was returned. I don't see any errors in my definition, unless there is a magic order to it I'm unaware of.

Message 4 of 8
anim8er3
in reply to: anim8er3

This works:

 

(while (= (tblobjname "LTYPE" "PHANTOM2") nil)
(progn
(setq fname (strcat (getvar "dwgprefix") "PHANTOM2.lin"))
(setq f (open fname "w"))
(princ "*PHANTOM2,Phantom \(.5x\) ___ _ _ ___ _ _ ___ _ _ ___ _ _\nA,.625,-.125,.125,-.125,.125,-.125\n" f)
(close f)
(command "-LINETYPE" "L" "PHANTOM2" fname "")
)
)

 

But not the method I wanted to use.

Message 5 of 8
dgorsman
in reply to: anim8er3

I don't have it handy right now, but check in the ENTMAKE help.  I seem to remember something about only certain linetypes can be made programmatically, and that some types (symbol/text using?) could not.  I could be completely wrong, though.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 6 of 8
Rtogores
in reply to: dgorsman

This function creates a new LINETYPE using entmake:

(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))))))

To test is you can use:


(ent-Linetype "LINE_1" "Created by entmake" '("A" 31.75 -6.35 6.35 -6.35))

Message 7 of 8
dbroad
in reply to: anim8er3

@anim8er3:

 

Both your original and the entmakex version should have worked fine and do work fine here.

 

In general, use entmakex for non-graphical data and entmake for graphical data.  The only difference between the two is that entmakex assigns no owner to the new entity.

 

What version of AutoCAD are you using?  

Architect, Registered NC, VA, SC, & GA.
Message 8 of 8
anim8er3
in reply to: dbroad

I'm using AutoCAD Map 3D 2011.

 

This now works:

 

(if (= (tblobjname "LTYPE" "PHANTOM2")nil)
(entmake (list '(0 . "LTYPE")
'(100 . "AcDbSymbolTableRecord")
'(100 . "AcDbLinetypeTableRecord")
'(2 . "PHANTOM2") '(70 . 0) '(3 . "Phantom \(.5x\)___ _ _ ___ _ _ ___ _ _ ___ _ _")
'(72 . 65) '(73 . 6) '(40 . 1.25) '(49 . 0.625) '(74 . 0) '(49 . -0.125) '(74 . 0)
'(49 . 0.125) '(74 . 0) '(49 . -0.125) '(74 . 0) '(49 . 0.125) '(74 . 0) '(49 . -0.125)
'(74 . 0)))
)

 

Looking at the code for ent-Linetype.lsp (which worked), I noticed that it generates a 74 code for each 49 code. That is apparently necessary for this version of AutoCAD.

 

Thanks for all the help.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost