Author Topic: about polyline slice  (Read 9043 times)

0 Members and 1 Guest are viewing this topic.

dussla

  • Bull Frog
  • Posts: 278
about polyline slice
« 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 ?~~

ribarm

  • Gator
  • Posts: 2640
  • Marko Ribar, architect
Re: about polyline slice
« Reply #1 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.
« Last Edit: May 14, 2015, 07:25:05 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

AIberto

  • Newt
  • Posts: 127
Re: about polyline slice
« Reply #2 on: May 14, 2015, 06:59:47 AM »
« Last Edit: May 19, 2015, 10:07:20 PM by AIberto »
AutoCad2012 ,Windows XP 32bit

ribarm

  • Gator
  • Posts: 2640
  • Marko Ribar, architect
Re: about polyline slice
« Reply #3 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...]
« Last Edit: June 25, 2015, 06:05:36 PM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 2640
  • Marko Ribar, architect
Re: about polyline slice
« Reply #4 on: May 15, 2015, 07:26:47 AM »
I've updated mkpoly.lsp ...

Regards, M.R.
 :gum:
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

dussla

  • Bull Frog
  • Posts: 278
Re: about polyline slice
« Reply #5 on: May 15, 2015, 08:10:08 AM »
i tested  that in 2008
but that is not work ~

dussla

  • Bull Frog
  • Posts: 278
Re: about polyline slice
« Reply #6 on: May 15, 2015, 08:11:26 AM »

ribarm

  • Gator
  • Posts: 2640
  • Marko Ribar, architect
Re: about polyline slice
« Reply #7 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.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Lee Mac

  • Seagull
  • Posts: 12659
  • London, England
Re: about polyline slice
« Reply #8 on: May 15, 2015, 09:05:21 AM »
This will get you most of the way there: Object Break.

ribarm

  • Gator
  • Posts: 2640
  • Marko Ribar, architect
Re: about polyline slice
« Reply #9 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.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

AIberto

  • Newt
  • Posts: 127
Re: about polyline slice
« Reply #10 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.
AutoCad2012 ,Windows XP 32bit

ribarm

  • Gator
  • Posts: 2640
  • Marko Ribar, architect
Re: about polyline slice
« Reply #11 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...]
« Last Edit: June 25, 2015, 06:06:03 PM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 2640
  • Marko Ribar, architect
Re: about polyline slice
« Reply #12 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.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 2640
  • Marko Ribar, architect
Re: about polyline slice
« Reply #13 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...]
« Last Edit: June 25, 2015, 06:07:20 PM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

andy_lee

  • Newt
  • Posts: 147
Re: about polyline slice
« Reply #14 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/
andy.
Best regards.