Author Topic: How to make linetype like this "----GAS----GAS----" by "Entmakex" function?  (Read 4820 times)

0 Members and 1 Guest are viewing this topic.

fools

  • Newt
  • Posts: 72
  • China
Hi,all!
I wrote below codes,but not work.What's the matter?
Thanks for your help!
Code: [Select]
(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)
     )
   )
 )
Good good study , day day up . Sorry about my Chinglish .

DEVITG

  • Bull Frog
  • Posts: 479
Why not to load the built in acad GAS line

Location @ Córdoba Argentina Using ACAD 2019  at Window 10

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
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.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
This isn't the most robust or efficient code but it may be food for thought.

Posted to Autodesk Customization newsgroup 2000/06/05 --

Quote
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?

Code: [Select]
(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)

)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Adesu

  • Guest
Hi fools,
try this code
Code: [Select]
(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

fools

  • Newt
  • Posts: 72
  • China
Thanks All.
After reading these codes,I think that using the .lin file will be better.
Good good study , day day up . Sorry about my Chinglish .

DEVITG

  • Bull Frog
  • Posts: 479
If on the shelf , use it
Location @ Córdoba Argentina Using ACAD 2019  at Window 10