TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: fools on March 02, 2008, 07:37:33 PM
-
Hi,all!
I wrote below codes,but not work.What's the matter?
Thanks for your help!
(IF (NOT (TBLOBJNAME "LTYPE" "GAS_LINE"))
(ENTMAKEX
(LIST '(0 . "LTYPE")
'(100 . "AcDbSymbolTableRecord")
'(100 . "AcDbLinetypeTableRecord")
'(2 . "GAS_LINE")
'(70 . 0)
'(3 . "Gas line ----GAS----GAS----GAS----GAS----GAS---")
'(72 . 65)
'(73 . 3)
'(40 . 24.13)
'(49 . 12.7)
'(74 . 0)
'(49 . -5.08)
'(74 . 2)
'(75 . 0)
(CONS 340 (TBLOBJNAME "STYLE" "Standard"))
'(46 . 2.54)
'(50 . 0.0)
'(44 . -2.54)
'(45 . -1.27)
'(9 . "GAS")
'(49 . -6.35)
'(74 . 0)
)
)
)
-
Why not to load the built in acad GAS line
-
See Ron's routine here.
http://www.theswamp.org/index.php?topic=21339.0
You can not create that linetype using entmake, you must use a file.
-
This isn't the most robust or efficient code but it may be food for thought.
Posted to Autodesk Customization newsgroup 2000/06/05 --
Custom Linetypes
Using Windows weirdo fonts like WingsDings, WebDings etc. to make custom
linetypes - anyone else do it?
Recently had a need based on a client request to make a linetype of lines
and solid dots. I didn't want to use a shape file because I don't like
having the *.shx dependency, so I penned the following as a potential
alternative.
Thoughts? Better ideas?
(defun c:MakeWingDingsDot ( / filename cmdecho expert regenmode handle )
[color=green];; _____________________________________________
;;
;;
;; 2000/06/05 Michael Puckett
;;
;; _____________________________________________
;;
;; Makes the LineType definition WingDingsDot
;; which is based on the Windows WingDings font,
;; a font available on most Windows machines.
;;
;; Appears as ...
;;
;; --- o --- o --- o --- o --- o --- o ---
;;
;; ... but the "o"'s are solid.
;;
;; _____________________________________________
;;
;; Why you may ask? An alternative to using
;; a shape file for the solid dot shape which
;; then would render the drawing shape file
;; dependent - never a good thing in my mind.
;; _____________________________________________[/color]
(setq
filename (strcat (getvar "tempprefix") "temp.lin")
cmdecho (getvar "cmdecho")
expert (getvar "expert")
regenmode (getvar "regenmode")
)
(setvar "cmdecho" 0)
(setvar "expert" 5)
(setvar "regenmode" 1)
(cond
( (setq handle (open filename "w"))
[color=green];; make linetype definition[/color]
(princ
(strcat
"*WingDingsDot,WingDingsDot "
"---- o ---- o ---- o ---- o ---- o ----\n"
"A,0.25,-0.125,[\"l\",Wingdings,"
"S=0.05,R=0.0,X=-0.0238,Y=-0.023],-0.125\n"
)
handle
)
(close handle)
[color=green];; Force update of style, whether or not it exists
;; Why? User may have associated a different font
;; file for the style which would change the linetype.
;; Entmake works fine to make the style, but
;; entmod doesn't update the font file correctly,
;; so go with brute force command ".style" ...[/color]
(command ".-style" "wingdings" "wingding.ttf" "0" "1" "0")
(while (eq 1 (logand 1 (getvar "cmdactive"))) (command ""))
(cond
[color=green];; load the created linetype definition[/color]
( (tblsearch "style" "wingdings")
(command ".-linetype" "_load" "WingDingsDot" filename "")
(princ "\nWingDingsDot linetype defined.")
)
[color=green];; problem with text style on which linetype depends[/color]
(
(princ "\nError: Could not make WingDings text style.")
)
)
)
[color=green];; I/O error when attempting to make linetype definition[/color]
( (princ (strcat "\nError: Could not open " filename " for output.")))
)
(setvar "cmdecho" cmdecho)
(setvar "expert" expert)
(setvar "regenmode" regenmode)
(princ)
)
-
Hi fools,
try this code
(if
;(not (tblobjname "ltype" "gas_line"))
(not (tblobjname "line" "gas_line"))
(progn
(entmake
(list ;'(0 . "LTYPE")
'(0 . "LINE")
;'(100 . "AcDbSymbolTableRecord")
;'(100 . "AcDbLinetypeTableRecord")
'(100 . "AcDbEntity")
'(100 . "AcDbLine")
'(67 . 0)
'(410 . "Model")
'(8 . "0")
'(6 . "GAS_LINE")
'(10 169.931 613.767 0.0)
'(11 1157.56 613.767 0.0)
'(210 0.0 0.0 1.0)
;'(2 . "GAS_LINE")
;'(70 . 0)
;'(3 . "Gas line ----GAS----GAS----GAS----GAS----GAS---")
;'(72 . 65)
;'(73 . 3)
;'(40 . 24.13)
;'(49 . 12.7)
;'(74 . 0)
;'(49 . -5.08)
;'(74 . 2)
;'(75 . 0)
;(cons 340 (tblobjname "STYLE" "Standard"))
;'(46 . 2.54)
;'(50 . 0.0)
;'(44 . -2.54)
;'(45 . -1.27)
;'(9 . "GAS")
;'(49 . -6.35)
;'(74 . 0)
) ; list
) ; entmake
) ; progn
) ; if
-
Thanks All.
After reading these codes,I think that using the .lin file will be better.
-
If on the shelf , use it