Jump to content

Trying again . . . !


Nick_101

Recommended Posts

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!:bloodshot:

Areas.zip

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...