Danielm103 Posted May 15 Posted May 15 from pyrx import Rx, Ge, Gi, Db, Ap, Ed import traceback from shapely import Polygon @Ap.Command() def doit(): try: db = Db.curDb() desc = Db.Polyline.desc() ps, id1, _ = Ed.Editor.entSel("\nPline1 :", desc) ps, id2, _ = Ed.Editor.entSel("\nPline2 :", desc) pline1 = Db.Polyline(id1) pline2 = Db.Polyline(id2) polygon1 = Polygon(pline1.toList()) polygon2 = Polygon(pline2.toList()) res = polygon1.intersection(polygon2) pl3 = Db.Polyline(list(res.exterior.coords)) pl3.setColorIndex(1) db.addToModelspace(pl3) print(res.area, pl3.getArea()) except Exception as err: traceback.print_exception(err) 1 Quote
BIGAL Posted May 15 Posted May 15 (edited) Not sure how this compares to Bpoly, pick point, then use entlast. I can see do multiple objects in one go though. Edited May 15 by BIGAL Quote
Danielm103 Posted May 15 Author Posted May 15 With shapely, you can make computations without the having the entities in the drawing. There are other calculations too https://shapely.readthedocs.io/en/stable/manual.html 1 Quote
Danielm103 Posted May 15 Author Posted May 15 12 minutes ago, BIGAL said: Not sure how this compares to Bpoly, pick point, then use entlast. I can see do multiple objects in one go though. It’s just another tool in the toolbox, right? acedTraceBoundary is a good option too 1 Quote
BIGAL Posted May 16 Posted May 16 (edited) I can see from the images the functions would be very handy at times. Often need to go to a mathematical solution to get a formula and hopefully some one has done that formula in say Lisp or Python. Have you thought about putting together a Word doc with your "Tools" no code just images etc and what they do. I have one for my lisps, it was created for the staff where I used to work.35 pages, around 3 lisps per page, keep adding and updating the file, something I need to do. The tools your providing are very useful. Edited May 16 by BIGAL Quote
SLW210 Posted May 16 Posted May 16 10 hours ago, Danielm103 said: With shapely, you can make computations without the having the entities in the drawing. There are other calculations too https://shapely.readthedocs.io/en/stable/manual.html I was about to ask you for the link. 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.