Jump to content

coordinates of a rectangle?


fatabass

Recommended Posts

Hi,

 

Thanks in advance for those who will try to help me with this problem.

 

I have lots of rectangles and i need to find the coordinates of the centroid of these and put them in Autocad. It takes ages to use massprop or finding them by dimensions manually.

 

Is there any shortway to put them automatically inside them?

 

Thank

you.

Sorry for bad english, not mother tongue.

Link to comment
Share on other sites

  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

  • fatabass

    12

  • ReMark

    9

  • eldon

    6

  • Tyke

    4

Top Posters In This Topic

Posted Images

Are these rectangles already in AutoCAD or are they somewhere else?

Are the rectangles formed from 4 lines or are they polylines that are closed?

Are all the rectangles parallel to either the X or Y axes?

Link to comment
Share on other sites

Are these rectangles already in AutoCAD or are they somewhere else?

Are the rectangles formed from 4 lines or are they polylines that are closed?

Are all the rectangles parallel to either the X or Y axes?

 

Thank you for your interest.

 

Rectangels are formed from 4 lines and i drew them using the command REC and then i make them Regions for using massprop, but not neccesery, i can leave them as i drew with "rec" command.

 

These rectanguler are all in a drawing right now, all of are both parallel to X and Y axes.

 

What I do right now is i draw Xlines parallel to Y and X axes, starting from point 0,0 and then i measure each of these rectangules centroids relative to these lines and find the centroids. It takes ages.

 

What I need is:

a node in the centroid of all these rectangles.

coordinates of these nodes. (seen on autocad if possible like X : 3455.. Y : 4445 )

and areas of these individual rectangles.

 

Thank you.

Link to comment
Share on other sites

Try placing a point in the centre by setting object snap to Endpoint and giving the command Point, then type "m2p" and select two diagonally opposite corners of the rectangle. The point command will remain active so you just need to repeat "m2p" and pick the two corners for each rectangle, when you're done press escape to end the point command.

You'll need to set the point style to something appropriate to what you are doing.

Link to comment
Share on other sites

Try placing a point in the centre by setting object snap to Endpoint and giving the command Point, then type "m2p" and select two diagonally opposite corners of the rectangle. The point command will remain active so you just need to repeat "m2p" and pick the two corners for each rectangle, when you're done press escape to end the point command.

You'll need to set the point style to something appropriate to what you are doing.

 

Thanks but it says unknown command m2p

Link to comment
Share on other sites

@ fatabass : have you started the point command BEFORE typing m2p?

 

MTP or M2P (both work) is a command modifier. It must be used after a command is started otherwise one gets the invalid command error response.

Link to comment
Share on other sites

MTP or M2P (both work) is a command modifier. It must be used after a command is started otherwise one gets the invalid command error response.

 

Thanks m2p works fine but i need to see the coordinates of that point too.

 

I will try to learn how to use those codes in the link you have provided.

Thanks.

Link to comment
Share on other sites

So you are going to attempt to write your own lisp program?

 

I do not know how to write lisp programs.

 

What I need is to see the coordinates of the centroid of the rectangle in Autocad in text, in the drawing and also the area of the rectangle.

 

I tried the lisp in the link you provided (gecen) but it did not work, I do not know why.

Link to comment
Share on other sites

There are ways to obtain the area of a rectangle and have it displayed using a lisp routine. There are also other lisp routines for obtaining the centroid of a rectangle or a polygon. You just have to put some effort into tracking them down. I have not come across one routine that will do both though.

Link to comment
Share on other sites

There are ways to obtain the area of a rectangle and have it displayed using a lisp routine. There are also other lisp routines for obtaining the centroid of a rectangle or a polygon. You just have to put some effort into tracking them down. I have not come across one routine that will do both though.

 

Thanks for your interest and help ReMark.

 

Where can I search for those lisps and what keywords would help me finding them ?

Link to comment
Share on other sites

I would search using something like this (type it just as you see it).

 

"centroid"+"lisp"

 

You can also take a hike over to the Cadalyst magazine website and do a search in their CAD Tips section. You'll find plenty of free lisp routines.

 

An example of what one can find at Cadalyst is this:

 

http://cadtips.cadalyst.com/mass-properties/center-line-gravity

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...