×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Picking up the centroid?

Picking up the centroid?

Picking up the centroid?

(OP)
Hi,

I was wondering if anyone knew of a way to highlight or identify the centroid of an area in Autocad.

thanks

Barry.

RE: Picking up the centroid?

Make your area a region (use the "region" command). Then Tools > Inquiry > Region/Mass Properties

RE: Picking up the centroid?

CODE

(defun C:CENTROID (/ ent vla_poly vla_region centroid)
(vl-load-com)
(if
(and (setq ent (car (entsel "\nSelect a polyline: ")))
(eq (cdadr (entget ent)) "LWPOLYLINE")
(eq (vla-get-closed
(setq vla_poly (vlax-ename->vla-object ent))
)
:vlax-true
)
)
(progn
(setq vla_region
(car (vlax-safearray->list
(vlax-variant-value
(vla-addregion
(vla-objectidtoobject
(vla-get-document
vla_poly
)
(vla-get-ownerid
vla_poly
)
)
(vlax-safearray-fill
(vlax-make-safearray
vlax-vbobject
(cons 0 (1- (length (list vla_poly))))
)
(list vla_poly)
)
)
)
)
)
)
(setq centroid (vlax-safearray->list
(vlax-variant-value
(vla-get-centroid vla_region)
)
)
)
(vla-delete vla_region)
)
)
centroid
)
(princ)

...borrowed somwhere in the www

Lothar

ADT 2004
ACAD 2002

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources