+ Reply to Thread
Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 33
  1. #1
    Full Member David D's Avatar
    Using
    AutoCAD 2010
    Join Date
    May 2011
    Posts
    50

    Default Need Macro..apparent center of polyline

    Registered forum members do not see this ad.

    I am wondering if there is a snap setting I am unable to find that would show the "apparent center" (basicaly, the center of the mass if it was solid) of a square, rectangle, or any other odd shaped polyline. I see it in circles but not other shapes.

  2. #2
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,951

    Default

    Try Mid Between Two Points (_m2p) for your osnap.

    For example:

    To snap to the center of a rectangle, start the line command and Shift + Right Click, pick 'Mid Between 2 Points', then select the lower left, and upper right corners of the rectangle.
    "Potential has a shelf life." - Margaret Atwood

  3. #3
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro 4000, 2GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2013
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    33,138

    Default

    From draftsperson.net:

    With the creation of a REGION or a 3D SOLID, it is possible to find the centroid of an object, with the MASSPROP function. MASSPROP is an AutoCAD function.
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

  4. #4
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,951

    Default

    Quote Originally Posted by ReMark View Post
    From draftsperson.net:

    With the creation of a REGION or a 3D SOLID, it is possible to find the centroid of an object, with the MASSPROP function. MASSPROP is an AutoCAD function.
    @ Mark -

    That won't work for a Polyline entity... the OP used Solid as an example, as you can snap to the centroid of the Region/Solid, but the OP wants to avoid that step altogether (as I understand it). More information is needed.

    @ Davd -

    Quote Originally Posted by David D View Post
    I am wondering if there is a snap setting I am unable to find that would show the "apparent center" ... of a square, rectangle, or any other odd shaped polyline. I see it in circles but not other shapes.
    How are you intending to 'show' the centroid?

    Do you mean using a line command, etc. you want to snap to the centroid of a given polyline, or do you want to pick a polyline, and mark the centroid by placing a point object, etc.?
    "Potential has a shelf life." - Margaret Atwood

  5. #5
    Full Member David D's Avatar
    Using
    AutoCAD 2010
    Join Date
    May 2011
    Posts
    50

    Default

    Renderman, I do not see the mp2 option. What I want it for is to position text that is middle center justified for aesthetic purposes. Shapes I am using are tool outlines, all sorts, sizes and shapes. I am working in 2d.
    Thank you

  6. #6
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro 4000, 2GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2013
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    33,138

    Default

    The m2p or mtp option is a command modifier. You have to use AFTER starting the command you are working with like Move, or Line or Circle, etc.
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

  7. #7
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,951

    Default

    Quote Originally Posted by David D View Post
    Renderman, I do not see the mp2 option. What I want it for is to position text that is middle center justified for aesthetic purposes. Shapes I am using are tool outlines, all sorts, sizes and shapes. I am working in 2d.
    Thank you
    Quote Originally Posted by ReMark View Post
    The m2p or mtp option is a command modifier. You have to use AFTER starting the command you are working with like Move, or Line or Circle, etc.
    Correct. You must manually (or programmatically) enter "_m2p" once you've bagan a command.

    Using your example, of moving text:

    Select the text, select the insertion grip (you listed Middle Center), then begin to move your mouse (you should see the text moving along), now at the keyboard type in "_m2p" (without the quotes) and hit Enter. You should now be prompted to select two points sequencially.

    Give it a try.
    "Potential has a shelf life." - Margaret Atwood

  8. #8
    Full Member David D's Avatar
    Using
    AutoCAD 2010
    Join Date
    May 2011
    Posts
    50

    Default

    Tried it. After typing _m2p and hit Enter I get this "Point or option keyword required."

  9. #9
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,951

    Default

    Quote Originally Posted by David D View Post
    Tried it. After typing _m2p and hit Enter I get this "Point or option keyword required."
    Works on my end (and has for years):

    Code:
    Command:
     
    ** STRETCH **
    Specify stretch point or [Base point/Copy/Undo/eXit]:
    >>Enter new value for ORTHOMODE <1>:
    Resuming GRIP_STRETCH command.
     
    Specify stretch point or [Base point/Copy/Undo/eXit]: _M2P
    First point of mid: Second point of mid:
    Command: *Cancel*
    "Potential has a shelf life." - Margaret Atwood

  10. #10
    Full Member David D's Avatar
    Using
    AutoCAD 2010
    Join Date
    May 2011
    Posts
    50

    Default

    Registered forum members do not see this ad.

    I worked with the sequence and got to work. Since I am doing this for many, many, many drawings I need to make a button with a macro (i think, new to this so may not have correct terminoligy) should I pursue this in this thread or start a new one.

Similar Threads

  1. Titles are Outlined for no apparent reason....
    By M29 in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 27th Jul 2010, 06:26 pm
  2. Apparent break in line
    By darylt in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 5
    Last Post: 25th Apr 2010, 03:40 pm
  3. How to get center point from polyline curve in VBA?
    By Andresig in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 16th Mar 2010, 07:46 pm
  4. polyline and multiline macro
    By russell84 in forum AutoCAD Beginners' Area
    Replies: 5
    Last Post: 18th Feb 2008, 12:43 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts