Nick_101 Posted January 20, 2009 Share Posted January 20, 2009 Here is my lisp file and a drawing file . . . . Any one who cares to have a look at them will see that the routine stops when it can't create a region, so any help to overcome this would be really great. Thanks Guys! Areas.zip Quote Link to comment Share on other sites More sharing options...
ASMI Posted January 20, 2009 Share Posted January 20, 2009 Hi, I advise you not to use the region for the calculation of the Centroid. And in general to follow the golden rule - the less you use the functions COMMAND the better. You can use the GetBoundingBox method to get Bottom-Left and Top-Right conners of polyline boundary. Try in command line: Command: (setq cPl(vlax-ename->vla-object(car(entsel)))) Select object: #<VLA-OBJECT IAcadLWPolyline 094731c4> Command: (vla-GetBoundingBox cPl 'blPt 'trPt) nil Command: (setq lPt(vlax-safearray->list blPt)) (64537.3 -10895.7 0.0) Command: (setq tPt(vlax-safearray->list trPt)) (70109.8 -6366.18 0.0) Now you can easily calculate center of bounding box. You can also extract polyline vertexes and calculate real Gravity Center (Centroid). Good luck Quote Link to comment Share on other sites More sharing options...
Nick_101 Posted January 20, 2009 Author Share Posted January 20, 2009 Hi ASMI, Many thanks for for your advice, I'll certainly try it and let you know how I get on with it! All the best Quote Link to comment Share on other sites More sharing options...
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.