Explode line style to separate entities

Hi.
Is there a way to explode or drop a line style to Individual entities. Example I have a line style gas line which is a line segment and the word gas and a line segment . I want to explode it to be separate objects.
After export from dxf to svg, the line styles was exploded, but coordinates are missing.

Comments

  • The most common way is to use WMFOUT and WMFIN.  I have read that the insertion point is the upper left corner of the viewport and scale factor should be 2X. 
  • Thank you, but these are the same curves crutches like in autocad.
    11DWG - original
    11WMF2DVG - result conversion dwg-wmf-dwg :-!
    image11DWG.png
    image11WMF2DWG.png
  • I should have tried this before I posted.  WMFIN does not appear to be supported in Bricscad yet.  I'll see if I can find a different solution later today.
  • @ Dima:
    I think you should clarify what you mean by 'missing coordinates' in your OP.
    A quick test with the GAS_LINE linetype shows no issue with SVG export (SVG tested in IE and FF).
  • I get reasonable results using Export > WMF then Import > WMF, but the conversion is not perfect.  The import has to be scaled and moved into position.

    What are the priorities -- having an exact copy of the original line or having smooth entities even if the text shifts position a bit?  It should be possible to read the linetype definition from the .lin file and recreate the components geometrically for reasonably simple types.  Not hard to program in LISP, but it would take some time to do.
  • If you're using WMF, then changing PictureExportScale in SETTINGS will improve resolution at the cost of file size. I also found that changing this value seemed to affect the linetype scale, but it may be something I was doing causing it. Export/import of linetype using a truetype font omits the font, so it would seem this method would only work on shx based linetypes.

    If you're after SVG output, then you can do this directly from BricsCAD using EXPORT. There are SVG Export options under SETTINGS. You can't import an SVG back into BricsCAD. I guess you would use something like Inkscape to convert back to DXF.

    Why would you want to explode a linetype?

    Alternate methods:
    • Isolate the linetypes required -> Print to PDF -> Attach generated PDF -> remove original lines -> Print to PDF
    • You can mimic complex linetypes using ARRAYPATH

    Regards,
    Jason Bourhill
    imagePictureExportScale.png
  • Jason Bourhill
    I get base map in DWG or DXF format.
    Qgis can read DXF but does not import the line styles.
    One of the way to getting the same map in GIS and in CAD is exploding line style in a CAD product.
  • @Roy Klein Gebbinck
    in DWG geodesic xy=1319016.9537, 485830.8852
    in SVG xy inside "svg viewBox"  xy=114.7443271604901,160.7858871613697
  • @Roy Klein Gebbinck
    [code]svg viewBox="0 0 210 297" version="1.1" xmlns=[/code]
    not
    [code]svg width="99828.02884513512mm" height="143236.04133719346mm" viewBox="1318917125.6364946 -485974121.2296523 99828.02884513512 143236.04133719346" version="1.1" xmlns=[/code]

    Oops, I think I broke the forum....

  • The attached lisp routine effectively explodes  complex lines to line segments, shapes, and text.  Note that the text and shapes are actual text and shapes and are not exploded.  I create a new text style for each font used rather than trying to parse all the existing text styles (to work around drawings that use multiple styles with the same font but with different fixed heights).   My office does model space only drawings and I haven't tested in paper space. 

    xl.lsp

  • The attached lisp routine effectively explodes  complex lines to line segments, shapes, and text.


    Impressed. Nice to see such an extensive example of VLE functions.

    Minor comment on parse_shape_file. Shouldn't it close the shape file after it's been read?

    Regards,
    Jason Bourhill

  • Qgis can read DXF but does not import the line styles.
    One of the way to getting the same map in GIS and in CAD is exploding line style in a CAD product.


    I still don't get this approach. You may have something in the GIS that is visually correct, but has lost useful data. Wouldn't it be simpler to print the drawing to image, and store the image in the GIS in its own layer alongside the vector data?

    Regards,
    Jason Bourhill

  • @H Martin Shoemaker

    Perfectly, all my line styles are exploded, the touches remain in place, but  error occurs when the exploading lines of style "by layer" or "continous".
    [code]
    ; ----- LISP : Call Stack -----
    ; [0]...C:XL <<--<br>;
    ; ----- Error around expression -----
    (/ E_LENGTH P_LENGTH)
    ;
    Error: divide by zero at [/][/code]
    I don't program in Lisp , so waiting for your solution.

    @Jason Bourhill

    When printing from CAD to raster format and loading it to GIS, I lose the coordinates and what is more important - in different scale a raster looks less presentable than a vector.


  • When printing from CAD to raster format and loading it to GIS, I lose the coordinates and what is more important - in different scale a raster looks less presentable than a vector.


    You could generate a world file as part of the print process (would require some programming), which would allow the image generated to be attached with the correct coordinates.

    I don't know how involved your drawings are, but exploding linetypes will cause a massive increase in file size.

    Regards, Jason Bourhill CAD Concepts
  • Jason Bourhill
    Tests results are as follows:
    original dwg : 868 kb
    exploded dwg : 1004 kb
    png 400dpi :  617 kb
    and the dependence will be quadratic, but...
    image11-dxf.png
    image11-png.png
  • @ Jason:  Thank you for the compliment and the suggestion.  I added a close statement.

    @ Dima:  Please try the attached version.  It should work with lines, arcs, splines, and LWpolylines.  Be aware that polylines are treated as one continuous entity, not as segments.  It should be possible to check the linetype-mode setting for a polyline and automatically explode the pline.  For now you can manually explode plines before running the function if the pline needs to be treated as segments.  When I get time I'll look at automating this for plines and at adding circle entities.

    I have only run basic tests on the new version so please let me know if there are other problems.

    xl.lsp

  • @H Martin Shoemaker
    Let's continue joint programming ))))
    [code];
     ----- LISP : Call Stack -----
    ; [0]...C:XL <<--<br>;
    ; ----- Error around expression -----
    (/ E_LENGTH P_LENGTH)
    ;
    Error: divide by zero at [/]
    : ._undo[/code]

    11-1.dwg

  • @ Dima,

    The drawing you posted has a single polyline arc with linetype CONTINUOUS.  Is the example strictly to show the divide by zero error?  My testing was on complex linetypes only.  Your testing on a continuous linetype entity could be because you did a crossing window selection that happened to include the entity or it could be because you are wanting plines  converted lines and arcs.  Please let me know.

    The attached file should fix the divide by zero issue. Again, limited testing.



    xl.lsp

  • @H Martin Shoemaker

    Line, polyline, circle arc, spline - exploded.
    Ellipse, elliptical arc and circle - not.
    I checked for the explosion of the whole drawing.
    The elements on which the error occurs is in the attachment.


    Black line

    ; ----- LISP : Call Stack -----
    ; [0]...C:XL <<--<br>;
    ; ----- Error around expression -----
    (/ E_LENGTH P_LENGTH)
    ;
    Error: divide by zero at [/]
    : ._undo
    Undo:  Mark/Back to mark/BEgin set/End set/Control/Auto/: end

    Red polyline
    not found shx for linestyle

    ; ----- LISP : Call Stack -----
    ; [0]...C:XL
    ; [1].....PARSE_SHAPE_FILE <<--<br>;
    ; ----- Error around expression -----
    (VLE-NTH1 DATA)
    ;
    Error: bad argument type ; expected at [*]
    : ._undo
    Undo:  Mark/Back to mark/BEgin set/End set/Control/Auto/: end

    11-2.dwg

  • @ Dima,

    Circles, ellipses, and elliptical ares are not supported yet.  I plan to add at least circles, but it may be several days before I have time to do so.

    For the red line in your drawing the problem is that the linetype is set to "CONTI" instead of "CONTINUOUS".  I have not found a reference that says "CONTI" is a formal abbreviation for "CONTINUOUS".  Unless I find such a reference I probably will not change the operation of the function.

    For the red line you apparently don't have a file named "GK_forms.shx" on your computer in a location where the FINDFILE function can locate it.  I will look to see if there is a good solution when I have free time.

    Please remember that XL.LSP is software I am writing as a hobby project.  It is not commercial software.  It will probably never work with all entities and it certainly will never have all the error checking commercial software would have. 
  • I have attached a revised version that should work with circles, ellipses, and elliptical arcs, and it respects PLINEGEN settings.  The name has been changed to XC because XL is an existing command.

    In some cases there are small differences between the output of the function and the original linework.  I think the differences are due to differences in number precision in LISP compared to the precision in the internal functions or to differences in rounding methods, but the inaccuracies are so small that they are only apparent if the original is overlaid on the exploded version.  The errors are worse for complex linetypes with text or symbols for arcs, circle, and splines of very small radius.  For complex linework that has large enough radii to look good on the screen the errors are so small that it doesn't make sense to track down the underlying issue.  I also expect that the errors are no worse than what happens with WMFOUT/WMFIN. 

    This function is designed to work with normal linework.  Some entities may give incorrect results.  Examples would be circles and ellipses that have been "reversed" to change the orientation of text or symbols.

    Please let me know if you find entities the function does not work properly with.

    xc.lsp


  • Hi Martin,

    Your XC.lsp is wonderful and can be useful to a number of people. I understand it is not complete and may not handle all data types.

    Would you mind if we add this LSP to our CADPower build and offer it is a freeware program? Meaning, it is never going to expire and will join a number of FREEWARE utilities already in CADPower that helps users make the transition to BricsCAD. We use this as a support tool for BrcsCAD trial users in India to make their life easier by offering all commonly asked routines in the free, light version of CADPower.

    We will offer you full credits in the command startup in the manner you desire.

    Best Regards
    Rakesh Rao
    Smarter .dwg CAD
  • Rakesh,

    You are welcome to include xc.lsp in your freeware.  Whatever your normal attribution is will be fine.

  • Thank you, Martin.

This discussion has been closed.