Create a new line type

Create a new line type

nissan
Explorer Explorer
1,279 Views
11 Replies
Message 1 of 12

Create a new line type

nissan
Explorer
Explorer

Hi,

I am looking for a freelancer who can create a new type of line for AutoCAD according to the attached image.

Regards,

Nissan.

 

0 Likes
1,280 Views
11 Replies
Replies (11)
Message 2 of 12

-didier-
Advisor
Advisor

Bonjour @nissan 

 

from what I know, it is not possible with a native command.
You cannot set a thickness with line types.
I tried with Mline but there too it is not possible to put a thickness.
If they are only two-point and straight segments, a solution would be to make a dynamic block maybe!.

2025-07-21_16-14-25.gif

 

Amicalement

Éternel débutant.. my site for learning : Programmer dans AutoCAD

DA

EESignature

0 Likes
Message 3 of 12

CADaSchtroumpf
Advisor
Advisor

Hi,

I have this which is near (you might have to change the Y scale to get closer to your pattern, I'll let you do that)

Simply copy and paste the following on the command line and the "ALTERNATIVE" line type will be available.

((lambda ( / f_lin doc)
  (if (not (tblsearch "STYLE" "ALTERNATIVE"))
    (entmakex
      '(
        (0 . "STYLE")
        (100 . "AcDbSymbolTableRecord")
        (100 . "AcDbTextStyleTableRecord")
        (2 . "ALTERNATIVE")
        (70 . 0)
        (40 . 0.0)
        (41 . 1.0)
        (50 . 0.0)
        (71 . 0)
        (42 . 1.0)
        (3 . "ARIAL.TTF")
        (4 . "")
       )
    )
  )
  (entmake
    (list
      '(0 . "LTYPE")
      '(100 . "AcDbSymbolTableRecord")
      '(100 . "AcDbLinetypeTableRecord")
      '(2 . "ALTERNATIVE")
      '(70 . 0)
      '(3 . "alterné")
      '(72 . 65)
      '(73 . 3)
      '(40 . 1.287)
      '(49 . 0.0)
      '(74 . 2)
      '(75 . 0)
      (CONS 340 (TBLOBJNAME "STYLE" "ALTERNATIVE"))
      '(46 . 1.0)
      '(50 . 0.0)
      '(44 . -0.595)
      '(45 . -0.3215)
      '(9 . "■")
      '(49 . -0.6435)
      '(74 . 2)
      '(75 . 0)
      (CONS 340 (TBLOBJNAME "STYLE" "ALTERNATIVE"))
      '(46 . 1.0)
      '(50 . 0.0)
      '(44 . -0.595)
      '(45 . -0.3215)
      '(9 . "□")
      '(49 . -0.6435)
      '(74 . 0)
    )
  )
  (if (not (findfile "ALTERNATIVE.lin"))
    (progn
      (setq f_lin (open (strcat (getvar "ROAMABLEROOTPREFIX") "support\\ALTERNATIVE.lin") "w"))
      (write-line "*ALTERNATIVE,black-white" f_lin)
      (write-line "A,0,[\"\\U+25A0\",ALTERNATIVE,S=1,R=0,X=-0.595,Y=-0.3215],-0.6435,[\"\\U+25A1\",ALTERNATIVE,S=1,R=0,X=-0.595,Y=-0.3215],-0.6435" f_lin)
      (close f_lin)
    )
  )
  (setq doc (vla-get-activedocument (vlax-get-acad-object)))
  (if
    (and
      (not
        (vlax-for item (vla-get-linetypes doc)
          (if (= (strcase (vla-get-name item)) (strcase "ALTERNATIVE")) T)
        )
      )
      (vl-catch-all-error-p
        (vl-catch-all-apply
          'vla-load
          (list (vla-get-Linetypes doc) "ALTERNATIVE" "ALTERNATIVE.lin")
        )
      )
    )
    nil
    T
  )
  (princ "\nType Line \"ALTERNATIVE\" created!")
  (prin1)
))

 

Message 4 of 12

Kent1Cooper
Consultant
Consultant

The same kind of thing has been requested multiple times before.  If I can find an example, I'll post a link, but you should do some Searching.

EDIT:  I found >this<, which indicates that the one I was really looking for is no longer accessible.  But if that kind of thing might work for you, I do have Shape and Linetype definitions that will do it.

Kent1Cooper_0-1753117585459.png

But it can't do the edges in a different color than the mid-line wide parts, as in your image -- that is not possible in a linetype definition.  The color difference is possible in a MultiLine Style, but I don't think the fill-the-space width part is, and you wouldn't be able to do curves at all.

I think if you find suggestions in other similar Topics, the main one will involve a wide dashed Polyline with the edges Offset from it by half its width, and given zero width themselves.  There may be routines out there to automate that for you, but the result will be three independent Polylines, so revising the route will skew the relationship.

Kent Cooper, AIA
0 Likes
Message 5 of 12

-didier-
Advisor
Advisor

Bonjour @CADaSchtroumpf 

 

wow! really clever the idea of using shapes via exotic fonts!
Well done, I am happy to be contradicted.
The French Autolisp still shines!

 

Amicalement

Éternel débutant.. my site for learning : Programmer dans AutoCAD

DA

EESignature

0 Likes
Message 6 of 12

Sea-Haven
Mentor
Mentor

I have been making that linetype for years, use it for stormwater pipes. Ok I cheat the outside is 2 plines and the center is a pline with a width, the outsides  and inside can be different layers. The width matches a pipe diameter, the length of the solid is set to 2.35 a length of a pipe. It uses the linetype I called Equal so just set linetype scale.

Will post some code I wrote originally in 2014 so needs updating only does lines at moment. Has lots of sizes preset.

 

SeaHaven_0-1753140172437.png

 

 

 

0 Likes
Message 7 of 12

nissan
Explorer
Explorer

It looks good. can you send the code ?

0 Likes
Message 8 of 12

Sea-Haven
Mentor
Mentor

Give this a try but you must have the "Equal" linetype loaded save in your dwt etc. I have to add a check ltscale as it will effect the pipe spacing also.

*EQUAL,_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
A,1.0,-1.0

I work metric so may need mod for answers in feet.

 

 

0 Likes
Message 9 of 12

Moshe-A
Mentor
Mentor

@Sea-Haven  hi,

 

Would like your deep pro opinion on the attached.

 

thank you 😀

Moshe

 

0 Likes
Message 10 of 12

Sea-Haven
Mentor
Mentor

I am using Bricscad more these days. Sent you a pm.

0 Likes
Message 11 of 12

Moshe-A
Mentor
Mentor

Alan hi,

 

What i was expecting is your feedback on the program as a user. if can not run it never mind.

 

Moshe

0 Likes
Message 12 of 12

Sea-Haven
Mentor
Mentor

@Moshe-A had a look at it and the dcl was impressive as a front end. Using the 3 plines etc is a simple way around the task in my case draw a stormwater pipe, the pline wdith was set as diameter and length was 2.3 long so for concrete pipes could simply count the number of pipes needed on short pipes. As your making a block of answer why not use a pline with an Equal spacing and correct width then no solids. 

 

Re using solid, many years ago the reason I wrote the 3 line version was that an older version used solid's so erasing was a problem as it left solids behind. Looking again could maybe use Group to combine the 3 lines. I will try to find a version that I had extended and trimmed the lines to suit the connection to drainage pits when on an angle a common task in civil works.

 

SeaHaven_0-1755477074412.png

 

 

 

 

 

0 Likes