See the top rated post in this thread. Click here

Results 1 to 3 of 3

Thread: Finding the Center Point of a Polyline ?

  1. #1
    I could stop if I wanted to
    Join Date
    2005-08
    Posts
    378
    Login to Give a bone
    0

    Cool Finding the Center Point of a Polyline ?

    Guys,
    How can I find the center of a closed polyline shape drawn, as I want to place text there ?

    Stephen

  2. #2
    100 Club CADmium's Avatar
    Join Date
    2004-08
    Location
    Eberswalde, Germany, Europe
    Posts
    128
    Login to Give a bone
    1

    Default Re: Finding the Center Point of a Polyline ?

    a simple routine to try .. saves the Centerpoint to he sysvar "LASTPOINT" an creates a circle ..
    Code:
    (defun c:PLCENTER (/ PL RE P)  
      (if(setq PL(car(entsel "\nSELECT PL:")))
        (progn
          (command "_undo" "_m")
          (command "_region" PL "")
          (if(and(setq RE(vlax-ename->vla-object (entlast)))
                 (=(strcase(vla-get-objectname RE)) "ACDBREGION")
                 (setq P (vla-get-centroid RE))
                 (setq P(vlax-safearray->list(vlax-variant-value P)))      
             )
            (setvar "LASTPOINT" P)        
          )
          (command "_undo" "_b")
        )  
      )
      (if P (command "_circle" P 5))
    )

  3. #3
    I could stop if I wanted to
    Join Date
    2005-08
    Posts
    378
    Login to Give a bone
    0

    Cool Re: Finding the Center Point of a Polyline ?

    Thomas,
    Your on fire, reply after reply, thanks heaps. I am actually wanting to use it with the area thread as set the location for the text. I will have a play and see how it goes.

    Thanks again

    Stephen

Similar Threads

  1. Polyline Coordinates finding
    By avinash patil in forum VBA/COM Interop
    Replies: 1
    Last Post: 2012-08-30, 11:29 AM
  2. 2000: finding my center
    By concretelackey in forum AutoCAD LT - General
    Replies: 9
    Last Post: 2012-02-26, 06:57 PM
  3. Finding a point on a line to start from
    By jgratton in forum AutoCAD 3D (2007 and above)
    Replies: 8
    Last Post: 2008-09-23, 02:54 PM
  4. Replies: 10
    Last Post: 2007-03-23, 01:50 AM
  5. Replies: 9
    Last Post: 2007-02-21, 10:43 PM

Posting Permissions

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