TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: dussla on May 13, 2015, 10:35:18 PM

Title: about polyline slice
Post by: dussla on May 13, 2015, 10:35:18 PM
i seen this lisp
http://lanloylisp.blogspot.kr/2013/03/PolylineSlice.html

pls is this code is possible ?~~
Title: Re: about polyline slice
Post by: ribarm on May 14, 2015, 06:33:21 AM
I can do it with few more steps...

Code: [Select]
(defun c:regs2lws ( / pea ss i reg n k m p z f )

  (vl-load-com)

  (setq pea (getvar 'peditaccept))
  (prompt "\nSelect REGIONS convertable to lwpolylines (lines+arcs) to convert them to LWPOLYLINES...")
  (while (null (setq ss (ssget "_:L" '((0 . "REGION")))))
    (prompt "\nEmpty sel. set... Try selecting again...")
  )
  (setq k 0 m 0)
  (repeat (setq i (sslength ss))
    (setq reg (ssname ss (setq i (1- i))))
    (setq n (vlax-safearray->list (vlax-variant-value (vla-get-normal (vlax-ename->vla-object reg)))))
    (command "_.UCS" "_W")
    (command "_.EXPLODE" reg)
    (while (> (getvar 'cmdactive) 0) (command ""))
    (if (vl-every '(lambda ( x ) (or (eq (cdr (assoc 0 (entget x))) "LINE") (eq (cdr (assoc 0 (entget x))) "ARC")))
          (vl-remove-if 'listp (mapcar 'cadr (ssnamex (ssget "_P"))))
        )
        (progn
          (setq m (1+ m) z t)
          (setq p (vlax-curve-getstartpoint (entlast)))
          (command "_.UCS" "_M" p)
          (command "_.UCS" "_ZA" "" n)
          (setvar 'peditaccept 1)
          (command "_.PEDIT" "_M" (ssget "_P") "" "_J")
          (while (> (getvar 'cmdactive) 0) (command ""))
        )
        (progn
          (setq k (1+ k) f t)
          (command "_.UNDO" "")
        )
    )
  )
  (command "_.UCS" "_W")
  (if z (progn (prompt "\nThere were : ") (princ m) (prompt " REGIONS - that were converted to LWPOLYLINES")))
  (if f (progn (prompt "\nThere were : ") (princ k) (prompt " REGIONS - that were impossible to be converted to LWPOLYLINES")))
  (setvar 'peditaccept pea)
  (princ)
)

PLINTAV.LSP from PLINETOOLS posted here :
http://www.cadtutor.net/forum/showthread.php?67924-Draw-polyline-along-with-2-or-more-adjacent-closed-polylines/page3&p=#25

M.R.
Title: Re: about polyline slice
Post by: AIberto on May 14, 2015, 06:59:47 AM
???

http://bbs.mjtd.com/thread-82692-1-1.html
Title: Re: about polyline slice
Post by: ribarm on May 14, 2015, 01:31:10 PM
Maybe something like this - stolen from CAB...

HTH, M.R.

[EDIT : Now should work with WCS SPLINEs to create REGIONs...]

[EDIT : Updated again - it was 8 downloads till reattaching...]

[EDIT : Updated again - it was 10 downloads till new reattaching...]

[EDIT : Updated again - it was 4 downloads till new reattaching...]

[EDIT : Updated again - it was 13 downloads till new reattaching...]
Title: Re: about polyline slice
Post by: ribarm on May 15, 2015, 07:26:47 AM
I've updated mkpoly.lsp ...

Regards, M.R.
 :gum:
Title: Re: about polyline slice
Post by: dussla on May 15, 2015, 08:10:08 AM
i tested  that in 2008
but that is not work ~
Title: Re: about polyline slice
Post by: dussla on May 15, 2015, 08:11:26 AM
???

http://bbs.mjtd.com/thread-82692-1-1.html

i tested that
but that is not work
i use 2008
Title: Re: about polyline slice
Post by: ribarm on May 15, 2015, 08:17:57 AM
dussla, try to scale all entities to reasonable extents... Maybe routine displays that picked boundary point is on boundary... So you should scale it down if your 2D entities are large (to be in range 0,0 to 50,50)... You can use scale factor 0.001 foe ex., and when CAD makes boundaries than scale it up with scale factor 1000.0...

HTH, M.R.
Title: Re: about polyline slice
Post by: Lee Mac on May 15, 2015, 09:05:21 AM
This will get you most of the way there: Object Break (http://www.lee-mac.com/objectbreak.html).
Title: Re: about polyline slice
Post by: ribarm on May 15, 2015, 11:06:57 AM
dussla, try to scale all entities to reasonable extents... Maybe routine displays that picked boundary point is on boundary... So you should scale it down if your 2D entities are large (to be in range 0,0 to 50,50)... You can use scale factor 0.001 foe ex., and when CAD makes boundaries than scale it up with scale factor 1000.0...

Updated again with dynamic fuzzbound - dependable from zoom selection extents... In some cases when some geometry is significantly smaller than selection extents it may pick point on boundary, so that those parts may be skipped...

HTH, M.R.
Title: Re: about polyline slice
Post by: AIberto on May 15, 2015, 08:47:51 PM
dussla, try to scale all entities to reasonable extents... Maybe routine displays that picked boundary point is on boundary... So you should scale it down if your 2D entities are large (to be in range 0,0 to 50,50)... You can use scale factor 0.001 foe ex., and when CAD makes boundaries than scale it up with scale factor 1000.0...

Updated again with dynamic fuzzbound - dependable from zoom selection extents... In some cases when some geometry is significantly smaller than selection extents it may pick point on boundary, so that those parts may be skipped...

HTH, M.R.


Nice one ! marko.
Title: Re: about polyline slice
Post by: ribarm on May 18, 2015, 08:15:17 AM
Thanks, I've updated again both mkpoly.lsp and mkpoly-inside.lsp, now with some mods in CAB's code... Have predicted at first glance XLINEs and RAYs, but finally give it up from this... I've created also version based on mkpoly.lsp... It does what's shown on this attached gif...

[EDIT : Updated again - it was 17 downloads till new reattaching...]
Title: Re: about polyline slice
Post by: ribarm on May 18, 2015, 02:12:47 PM
I've updated again... Found some issues with OVERKILL-MR placed inside mkpoly.lsp and mkpoly-inside.lsp...

My sincerely apology for inconvenience...

M.R.
Title: Re: about polyline slice
Post by: ribarm on May 19, 2015, 05:58:28 AM
One more usage... Now added LM's outline functions... Valid entities are : LINE, LWPOLYLINE, ARC, CIRCLE... (not ELLIPSE, or SPLINE)... Routine is called WALLS.lsp

Hope you like it...
M.R.

[EDIT : Minor change - 21 downloads till I reattached walls.lsp and added walls2d.lsp]

[EDIT : Updated again - it was 8 downloads till new reattaching...]
Title: Re: about polyline slice
Post by: andy_lee on May 19, 2015, 07:41:04 AM
One more usage... Now added LM's outline functions... Valid entities are : LINE, LWPOLYLINE, ARC, CIRCLE... (not ELLIPSE, or SPLINE)... Routine is called WALLS.lsp

Hope you like it...
M.R.


Great , marko. I think you need replace your  Gif Record Software
http://www.cockos.com/licecap/
Title: Re: about polyline slice
Post by: andy_lee on May 19, 2015, 07:55:24 AM
marko. why?

Enter inside wall width : 10     actual value :20
inside wall height :50           

Enter outside wall width : 20        actual value :5
outside wall height :100
Title: Re: about polyline slice
Post by: ribarm on May 19, 2015, 10:34:18 AM
emk2012, I don't have those problems... Maybe it's because I don't use OSNAPs... Place (setvar 'osmode 0) line right before main code - inside (defun c:walls ( / ... ))
Code: [Select]
(defun c:walls ( / ... )

  (vl-load-com)

  (defun *error* ( msg )
    ...
    (princ)
  )

... here ... (setvar 'osmode 0)

... rest of code ...

  (*error* nil)
)

M.R.
Title: Re: about polyline slice
Post by: ribarm on June 15, 2015, 02:55:13 PM
I've updated my lisps posted here :

http://www.theswamp.org/index.php?topic=49453.msg546152#msg546152

Minor changes inside LM's outline function...
Title: Re: about polyline slice
Post by: AIberto on June 15, 2015, 09:57:30 PM
I've updated my lisps posted here :

http://www.theswamp.org/index.php?topic=49453.msg546152#msg546152

Minor changes inside LM's outline function...


Thanks for sharing!
Title: Re: about polyline slice
Post by: ribarm on June 26, 2015, 05:33:57 AM
Have found some lacks in walls and walls2d.lsp... Updated all posted routines in this topic...

Regards, M.R.

 :wink:
Title: Re: about polyline slice
Post by: ribarm on March 15, 2016, 04:59:22 AM
I've successfully updated all my walls lisps to be now applicable for latest versions of ACAD... On A2012+ it should operate on all type of 2d curves that lie in WCS (splines+ellipses included) - it uses OFFSETEDGE command... All lisps that have suffix *-old.lsp are intended to be used on versions A2012-... Lisps without suffix "old" are for A2012+...

HTH, M.R.