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

Is it possible convert a linetype into a continous line with spaces

49 REPLIES 49
Reply
Message 1 of 50
jjwiv
3339 Views, 49 Replies

Is it possible convert a linetype into a continous line with spaces

Since there is not a way to explode a linetype into a line created by continuous lines in that linetype style, is it possible to write a lisp file to convert specific linetypes into continuous lines in that linetype style? I have tried the exporting and importing (wmfout/in) but have found it is not accurate enough.

An example is a dashed linetype that has a repeating .2" line with a .05" space. I need to change all the lines with the dashed linetype to be created with continuous .2" lines and .05" spaces. The reason is we have conversion software for an older machine that does not recognize linetypes. If is sees a linetype it just ignores it and defaults to a continuous line. It takes a long time to manually break the lines to make them look like the linetype called out so I am trying to find something faster.

If this is possible, any pointers would be greatly appreciated as it has been a long time since I have written a lisp file.

Thanks!
49 REPLIES 49
Message 21 of 50
komondormrex
in reply to: Kent1Cooper


@Kent1Cooper wrote:
will inspire me to take another look at it.

just wondering why do not you get the real world linetypes [stored in a given drawing] and 'break up' picked curves depending on those?

Message 22 of 50


@vladimir_michl wrote:

.... an alternative approach using WMF or PDF? ....


These commands are not necessarily intended to duplicate the current appearance of non-continuous objects in the drawing.  They will take any kind of object and Break it Up into pieces emulating the linetype named in the command, whatever its current linetype [typically expected to be used on things of continuous linetype if they're not already of the command's linetype].  That includes 3D Polylines, which do not honor non-continuous linetypes in display, so the approach going through WMF or PDF cannot do what these commands can do with them.  [See the comments at the top of the file for some particular circumstances under which the result can differ slightly from the appearance of the whole object with the non-continuous linetype assigned.]

Kent Cooper, AIA
Message 23 of 50
Kent1Cooper
in reply to: komondormrex


@komondormrex wrote:

@Kent1Cooper wrote:
will inspire me to take another look at it.

just wondering why do not you get the real world linetypes [stored in a given drawing] and 'break up' picked curves depending on those?


I think you misunderstand the intent somewhat -- See Message 22.  These commands are to Break things Up into separate pieces emulating AutoCAD's [and a few of my own] defined linetypes whether or not the one specified in the chosen command name is currently loaded in the drawing.

 

To emulate a linetype that is in the drawing but not one of AutoCAD's, I think it would be necessary for a command to extract the linetype definition with something like the LINOUT program, and since that creates a .lin file, to open that, find which part of it defines the dashes/gaps/points, and work out the breaking up in similar fashion to how the BreakUp commands do it.  It may be possible, but sounds very complex.  It might be comparatively simple if it can recognize a definition as being in the same kind of pattern as one of AutoCAD's, but simply with different dash and gap lengths.  But if, for example, gap sizes vary within the same linetype definition [they don't within AutoCAD's linetype definitions, so there's only ever one gap-size entry to work with], or there are more pen-up/pen-down cycles than any of AutoCAD's have, it would somehow need to create the whole sequence of operations as a new "family" entirely,  In that case, if one wants to break up something to emulate the way it looks under its linetype, then the WMF route may be better.

 

The "another look" will be mostly to address some of the things in the "SO FAR:" comments at the top of the file, or perhaps decide that some are not possible, or not worth pursuing, etc.

Kent Cooper, AIA
Message 24 of 50
komondormrex
in reply to: Kent1Cooper

you know what the op wanted some 13 years ago is slightly different from that what  your code does. and i think the main reason to explode or emulate complex linetypes is to not share those with customer or maybe ease him the using of drawings he will be sent over. anyway i still reckon that using real linetype definitions will be way better than something abstract. yours dots... they are awfully awful. and ellipse arcs too.

Message 25 of 50
komondormrex
in reply to: namlt33

hey there,

could you tell what is the main reason for you to break up complex linetypes? and which result will suit your needs the best?

Message 26 of 50
Kent1Cooper
in reply to: komondormrex


@komondormrex wrote:

you know what the op wanted some 13 years ago is slightly different from that what  your code does. and i think the main reason to explode or emulate complex linetypes is to not share those with customer or maybe ease him the using of drawings he will be sent over. .....


Maybe slightly different, but they seem to have been satisfied with it [see Message 10 & 13].

 

And that's not the main reason, which is explained in the second paragraph of Message 1.

Kent Cooper, AIA
Message 27 of 50
komondormrex
in reply to: Kent1Cooper

i honestly do believe nowadays there is no such old software that does not understand autocad complex linetypes...

Message 28 of 50
jjwiv
in reply to: komondormrex

@Kent1Cooper is correct

 

I originally posted the question and we still use software and equipment today that require continuous lines that create the "image" of a linetype.  If a line has a linetype assigned to it the software will convert it into a solid continuous line.

Message 29 of 50
komondormrex
in reply to: jjwiv

wow, how that is possible? somewhat cutting? how did you manage that before Kent's code? 

 

 

Message 30 of 50
john.uhden
in reply to: Kent1Cooper

I am impressed, @Kent1Cooper .

Are you also gonna start thinking about arcs and bulged segments? 🤔

How about splines? 😁

BTW, before emojis we used the acronyms <seg>. and <bseg>.

John F. Uhden

Message 31 of 50
john.uhden
in reply to: Kent1Cooper

@Kent1Cooper ,

You sure have bitten off a lot to chew.  We certainly don't want you choking.

I presume you will store the original object definition in some Xrecord along with the handles of the broken pieces so that based on a reactor picking up a change in the LTSCALE you can replace all the pieces with new ones.  Oh, and of course you will account for tapering polyline widths, right?  If you really continue with this, I think Percy has a second bed in his room at Briar Ridge. 😟

John F. Uhden

Message 32 of 50
john.uhden
in reply to: Sea-Haven

@Sea-Haven ,

OMG, remember the days when hatch patterns were implemented by the use of an anonymous block containing myriad lines?  A Dotted hatch would contain a zero-length line for  every dot.  It was so bad that I wrote a DOTHATCH routine that would use an ANSI31 pattern with a DOTTED linetype.

John F. Uhden

Message 33 of 50
Kent1Cooper
in reply to: john.uhden


@john.uhden wrote:

,,,. Are you also gonna start thinking about arcs and bulged segments?  How about splines? ....  and of course you will account for tapering polyline widths, right? ....


The commands already handle those things.

Kent Cooper, AIA
Message 34 of 50
namlt33
in reply to: komondormrex

I need to transfer roadmarking from autocad or civil 3d to infraworks model. The continuous line will result in a single white stripe so i need to break down these lines into pieces 

Message 35 of 50
komondormrex
in reply to: namlt33

could you post a couple of samples of lines with linetypes and needed break-ups of those. 

Message 36 of 50
Sea-Haven
in reply to: jjwiv

I have linetypes that are correct spacing etc for road line marking they are made at a 1:1 scale so match a true painted line.

 

*STATCON,__  __  __  __  __  __
A,0.60,-0.60
*CONTINUITY,______            ______
A,1.00,-2.00
*LANE,____        _____        ____
A,3.00,-9.00

 

Message 37 of 50
namlt33
in reply to: komondormrex

Just a dash gap dash type with .lin data file similar to: A, 075,-025. But as i mention above, i have to transfer those to infrawork model. I use mapexport on those line and get a shape file then import into infrawork. Now there are 2 option: 1 import .shp file as cover area ( i need to break the line since i using this method), 2 import .shp file as barrier (i then need to create 3d object that represent for a single white stripe, and then telll infra that object is a barrier and it laid on the import line, Also i got to define the objects direction, space between them to match the original dash gap dash. I just fined the ideal of break those lines into pieces via lisp routine is more convenient 

Message 38 of 50
Kent1Cooper
in reply to: Sea-Haven

Those would fall into the same BreakUp.lsp family as the DASHED and HIDDEN families of AutoCAD's linetypes [one Dash and one Gap, worked on using the BU-DG function].  So you can easily add into the file commands to do those, filling in the name, and the dash and gap sizes [not adjusted with the (lts) function if they are to be used as "raw" distances].  For example:

 

(defun C:BU-STATCON (/ BU-lt dash gap)
  (setq
    BU-lt "STATCON"
    dash 0.6
    gap 0.6
  ); setq
  (BU-DG)
); defun

Kent Cooper, AIA
Message 39 of 50
Kent1Cooper
in reply to: namlt33


@namlt33 wrote:

Just a dash gap dash type with .lin data file similar to: A, 075,-025. .... 


(defun C:BU-WHATEVER (/ BU-lt dash gap)
  (setq
    BU-lt "WHATEVER"
    dash 75
    gap 25
  ); setq
  (BU-DG)
); defun

Kent Cooper, AIA
Message 40 of 50
john.uhden
in reply to: namlt33

@namlt33 ,

I was just wondering if the MEASURE command might be all you need.

John F. Uhden

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

Post to forums  

Autodesk Design & Make Report

”Boost