Author Topic: ={ Challenge }=union subtract intersect  (Read 6261 times)

0 Members and 1 Guest are viewing this topic.

Q1241274614

  • Guest
={ Challenge }=union subtract intersect
« on: March 27, 2014, 06:25:06 AM »
help!thank!
(defun c:tt()
(setq ss (ssget '((0 . "LWPOLYLINE"))))
(if (= 2 (sslength ss))
(progn
(setq lst1 (apply 'append (mapcar(function(lambda ( a ) (if (= 10 (car a)) (list (cdr a))))) (entget (ssname ss 0)))))
(setq lst2 (apply 'append (mapcar(function(lambda ( a ) (if (= 10 (car a)) (list (cdr a))))) (entget (ssname ss 1)))))
(setq lst-union      (M:union       lst1 lst2));help?
(setq lst-subtract   (M:subtract    lst1 lst2));help?
(setq lst-intersect  (M:intersect   lst1 lst2));help?
)
)
(princ)
)

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Re: ={ Challenge }=union subtract intersect
« Reply #2 on: March 27, 2014, 06:55:51 AM »
Also, you may want to look into this topic...

http://www.theswamp.org/index.php?topic=43553.0
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Re: ={ Challenge }=union subtract intersect
« Reply #3 on: March 27, 2014, 07:09:33 AM »
Convert LWPOLYLINES to REGIONS... Perform MEO (Modeling Element Operations - Union, Subtract, Intersect)... Convert resulting REGION back to LWPOLYLINE... Obtain points from resulting LWPOLYLINE...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ymg

  • Guest
Re: ={ Challenge }=union subtract intersect
« Reply #4 on: March 27, 2014, 07:10:25 AM »
Making the union or intersection of the list will not give you the area you are after
unless you add the intersections point to both list.

Normal way would be to create region then union, intersect  or subtract.

ymg

GP

  • Newt
  • Posts: 83
  • Vercelli, Italy
Re: ={ Challenge }=union subtract intersect
« Reply #5 on: March 27, 2014, 07:14:37 AM »
Any issue becomes a challenge?  :roll:

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: ={ Challenge }=union subtract intersect
« Reply #6 on: March 27, 2014, 07:15:31 AM »
no region
Convert LWPOLYLINES to REGIONS... Perform MEO (Modeling Element Operations - Union, Subtract, Intersect)... Convert resulting REGION back to LWPOLYLINE... Obtain points from resulting LWPOLYLINE...
+1. easiest method: Use Region command to convert the polylines to regions. Use Intersect / Subtract / Union commands as needed on regions. Explode the regions into lines / arcs. Use pedit command to join them back into polylines.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: ={ Challenge }=union subtract intersect
« Reply #7 on: March 27, 2014, 07:16:47 AM »
no region
Why no region? Are you using ACad or some other CAD which does not have this type of object? Or do you simply not want regions?
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Re: ={ Challenge }=union subtract intersect
« Reply #8 on: March 27, 2014, 07:25:35 AM »
no region

Find intersection points between selected 2 LWPOLYLINES... Add these points as their Vertices... Obtain 2 point lists from both LWPOLYLINES... 1st LWPOLYLINE list of points is consisted from 2 sub lists separated by points of intersections; 2nd LWPOLYLINE list is similarly consisted from 2 sub lists... In combination of these 4 sub lists you can get resulting lists of Union, Subtraction or Intersection LWPOLYLINE...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Q1241274614

  • Guest
Re: ={ Challenge }=union subtract intersect
« Reply #9 on: March 27, 2014, 07:31:25 AM »
union

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Re: ={ Challenge }=union subtract intersect
« Reply #10 on: March 27, 2014, 07:34:17 AM »
Ha..., That's not union... You have to have 2 inside island POLYLINES...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: ={ Challenge }=union subtract intersect
« Reply #11 on: March 27, 2014, 07:36:51 AM »
union
That's not a union. A union of that shape should be something like this:

What you've drawn is a shrink-wrap.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Q1241274614

  • Guest
Re: ={ Challenge }=union subtract intersect
« Reply #12 on: March 27, 2014, 07:42:39 AM »
3 boundary, the results better!


snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: ={ Challenge }=union subtract intersect
« Reply #13 on: March 27, 2014, 09:05:27 AM »
Any issue becomes a challenge?  :roll:

Thanks GP, thought I was alone in thinking that.... :kewl:

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: ={ Challenge }=union subtract intersect
« Reply #14 on: March 27, 2014, 04:15:58 PM »
no region

Code: [Select]
(defun c:yad_plcomb(/ dxf chgent os qa entold kg s1 s2 n ss1 ss2 ent)
    ...
            (command "_.region" ent "")
    ...
            (command "_.region" ent "")
    ...
        (if ss2 (command "_.subtract" ss1 "" ss2 ""))
        (command (if (= kg "1") "_.union" "_.intersect") ss1 "")
    ...
      (if (and ent (= (dxf ent 0) "REGION") (not (equal ent entold)))
    ...
          (if (= (dxf (ssname ss1 0) 0) "REGION")
    ...

 :?

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: ={ Challenge }=union subtract intersect
« Reply #15 on: March 28, 2014, 01:21:46 AM »
Each of those can use a function which creates a temporary polyline from the list of points. Then it runs the region command to convert the polyline into a region. Then run the UNION/SUBTRACT/INTERSECT commands (this is the only thing which differs between these functions). Then explode the resulting region. Run "PEdit" "Multiple" <selection> "Yes" "Join" "" "" ... to convert them back into a poliline (or more depending on the shape like in that union example). Read their entget data and extract only the vector points. Delete the temporary objects and return the points you obtained from them.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

gile

  • Gator
  • Posts: 2520
  • Marseille, France
Re: ={ Challenge }=union subtract intersect
« Reply #16 on: March 29, 2014, 11:01:18 AM »
Hi,

You can have a look here (LISP code in reply #3). this is only for Union but may easily adapted for others Boolean operations.
Speaking English as a French Frog

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Re: ={ Challenge }=union subtract intersect
« Reply #17 on: March 29, 2014, 11:11:59 AM »
Gilles...
Code: [Select]
(setq reg (vlax-invoke space 'addRegion tmp))

OP doesn't want regions, just calculation of point list of resulting boolean polygon...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Q1241274614

  • Guest
Re: ={ Challenge }=union subtract intersect
« Reply #18 on: March 29, 2014, 12:10:34 PM »
yes

gile

  • Gator
  • Posts: 2520
  • Marseille, France
Re: ={ Challenge }=union subtract intersect
« Reply #19 on: March 29, 2014, 01:07:21 PM »
Oopss !...
Sorry, I don't have enough time right now for such a challenge.
Speaking English as a French Frog