Results 1 to 7 of 7

Thread: Converting Dashed Polyline with global width to Polyline Rectangles

  1. #1
    Member
    Join Date
    2016-09
    Posts
    2
    Login to Give a bone
    0

    Default Converting Dashed Polyline with global width to Polyline Rectangles

    Hi everyone,
    I have alot of Dashed polylines that have various global and I want to convert them to individual rectangles for each Polyline. Is there any way I can do it in autocad or is there a lisp do this ?

    Your help is appreciated.

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,804
    Login to Give a bone
    0

    Default Re: Converting Dashed Polyline with global width to Polyline Rectangles

    If you export the dashed polylines with a width to WMF, and then reimport the WMF file and explode it, the resulting rectangular "dash segments" will come in as two triangles, combined to form the shape of a rectangle. (see before and after in image)
    You could then explode those, delete the two inner lines, and rejoin the four outer ones.

    c55b1a.png
    R.K. McSwain | CAD Panacea |

  3. #3
    Member
    Join Date
    2016-09
    Posts
    2
    Login to Give a bone
    0

    Default Re: Converting Dashed Polyline with global width to Polyline Rectangles

    Thanks you for your reply. i tied the wmfout and in. unfotunately i didnt work propley as shown attched. any lisp can do the job ? please help Untitled1.png

  4. #4
    I could stop if I wanted to
    Join Date
    2002-08
    Posts
    231
    Login to Give a bone
    0

    Default Re: Converting Dashed Polyline with global width to Polyline Rectangles

    Quote Originally Posted by anashashem View Post
    Thanks you for your reply. i tied the wmfout and in. unfotunately i didnt work propley as shown attched. any lisp can do the job ? please help
    Hi,

    And if you try to use DXB format?
    You must before add plotter for this format.
    For have only the outline, put FILLMODE to 0 before plot the polylines dashed.
    After that youn can use _DXBIN command for import the result.

    Set the plotter correctly for a good insertion.

  5. #5
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Converting Dashed Polyline with global width to Polyline Rectangles

    Might be easier to remove the width, export & import WMF, change color to ByLayer, and reset the width.
    Discussion on linexp lisp By Dominic Panholzer: https://www.cadtutor.net/forum/topic...comment-129645

  6. #6
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    560
    Login to Give a bone
    0

    Default Re: Converting Dashed Polyline with global width to Polyline Rectangles

    This has been asked elsewhere the best method is to look at the line type coding length & gap. Take the linetype scale and work out the repeat line pattern. You need to take into account the shortening and lengthing of the start and end segments. Once you have that its easy to do rectangs. Probably start with some simple linetypes Dashed Ansi31 etc

  7. #7
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    560
    Login to Give a bone
    0

    Default Re: Converting Dashed Polyline with global width to Polyline Rectangles

    Testing something at moment but its not on priority list using known line type values like "dashed" its drawing individual lines as 1st step for a rectang. I have the offset to rectang code already.

    This works but only for lines at moment as a test program so explode pline 1st. It only supports 2 linetype variables some have 4.

    Its just step one no arcs supported.

    Code:
    ; convert linetype to lines. April 2020
    ; By Alan info@alanh.com.au
    
    ; *DASHED,Dashed __ __ __ __ __ __ __ __ __ __ __ __ __ _
    ; A,.5,-.25
    ; *DASHED2,Dashed (.5x) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    ; A,.25,-.125
    ; *DASHEDX2,Dashed (2x) ____  ____  ____  ____  ____  ___
    ; A,1.0,-.5
    ;*DASHEDX2,Dashed (2x) ____  ____  ____  ____  ____  ___
    ; A,1.0,-.5
    ; *HIDDEN,Hidden __ __ __ __ __ __ __ __ __ __ __ __ __ __
    ; A,.25,-.125
    ; *HIDDEN2,Hidden (.5x) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    ; A,.125,-.0625
    ; *HIDDENX2,Hidden (2x) ____ ____ ____ ____ ____ ____ ____ 
    ; A,.5,-.25
    
    
    (defun c:convlt ( / obj lt lts end start num num2 num3 addbit pt1 pt2 oldsnap oldlay)
    (defun exitnow ()
    (alert "non suppoted line type\n \nwill now exit")
    (exit)
    )
    (setq oldsnap (getvar 'osmode)
    oldlay (getvar 'clayer))
    (setq obj (vlax-ename->vla-object (car (entsel "Pick dashed line object "))))
    (setq glts (getvar 'ltscale))
    (setq lt (vlax-get Obj 'Linetype)
    lts (* (vlax-get Obj 'LinetypeScale) glts)
    endpt (vlax-get Obj 'EndPoint)
    startpt (vlax-get Obj 'StartPoint)
    dist (distance startpt endpt)
    ang (angle startpt endpt))
    (setvar 'clayer (vla-get-layer obj))
    (cond
    ((= lt "DASHED")(setq l1 (* 0.5 lts) l2 (* 0.25 lts)))
    ((= lt "DASHED2")(setq l1 (* 0.25 lts) l2 (* 0.125 lts)))
    ((= lt "DASHEDX2")(setq l1 (* 1.0 lts) l2 (* 0.5 lts)))
    ((= lt "HIDDEN")(setq l1 (* 0.25 lts) l2 (* 0.125 lts)))
    ((= lt "HIDDEN2")(setq l1 (* 0.125 lts) l2 (* 0.0625 lts)))
    ((= lt "HIDDENX2")(setq l1 (* 0.5 lts) l2 (* 0.25 lts)))
    ((exitnow))
    )
    (vla-delete obj)
    (setq seg (+ l1 l2)
    num (/ dist seg)
    num2 (fix num)
    num3 (- num (fix num))
    )
    (if (> num3 0.5)
    (setq addbit (/ (- dist (+ l1(* num2 seg))) 2.0))
    (setq addbit (/ (- dist (+ l1 (* num2 seg))) 2.0))
    )
    (setvar 'osmode 0)
    (setq pt1 (polar startpt ang (+ l1 addbit)))
    (command "line" startpt pt1 "" "chprop" "last" "" "Lt" "continuous" "")
    (repeat (- num2 1)
    (setq pt1 (polar pt1 ang l2))
    (setq pt2 (polar pt1 ang l1))
    (command "line" pt1 pt2 "" "chprop" "last" "" "Lt" "continuous" "")
    (setq pt1 pt2)
    )
    (setq pt1 (polar pt1 ang l2))
    (command "line" pt1 endpt "" "chprop" "last" "" "Lt" "continuous" "")
    (setvar 'osmode oldsnap)
    (setvar 'clayer oldlay)
    (princ)
    )
    (c:convlt)
    Last edited by BIG-AL; 2020-04-23 at 04:57 AM.

Similar Threads

  1. Select Polyline based on global width
    By Borgster in forum AutoLISP
    Replies: 5
    Last Post: 2014-02-08, 02:33 AM
  2. Polyline issue with global width... vertex between line and arc
    By david.musrie346034 in forum AutoCAD LT - General
    Replies: 6
    Last Post: 2012-12-11, 10:36 PM
  3. 2011: GLOBAL WIDTH NOT PRINTING
    By ivan.239950 in forum AutoCAD General
    Replies: 1
    Last Post: 2010-06-18, 06:34 AM
  4. Global Width @ intersections?
    By vsheehan in forum AutoCAD General
    Replies: 1
    Last Post: 2006-01-19, 08:20 AM
  5. Dashed lines not dashed in Layout view
    By pford in forum AutoCAD General
    Replies: 4
    Last Post: 2004-06-15, 07:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •