+ Reply to Thread
Page 1 of 5 1 2 3 ... LastLast
Results 1 to 10 of 48
  1. #1
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    Mar 2013
    Posts
    23

    Question Extracting X,Y, coordinates with Handle

    Registered forum members do not see this ad.

    I have attached an AutoCAD 2010 file as an example of what i am about to try and explain. Please bare with me.

    I can export the x/y information in itself using the ptExport.lsp routine. I haven't found a way of exporting the entity information because i can't seem to get that one working. (both lsp files attached)

    What i actually require is being able to extract the polygon x,y, information along with the corresponding text within the polygon itself i.e ITRD 33651 37, and ideally the entity handle itself.

    If you understood that, firstly thanks.
    If you know how to help then i would forever in your debt.

    Thanks in advance for looking

    Note i have to do this for somewhere in excess of 5000 polygons!! GULP!
    Attached Files

  2. #2
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,745

    Default

    A couple of ideas when doing a ssget you can do "WP" within polygon so do a ssget first make a list of polygons actually they are plines then use that polygon ID for your "WP" in the second ssget.

    Secondly theres lots of point from pline routines search here or Lee-mac.com

    You need this also for the code below to work tested with 4 points

    Code:
    (setq ss (ssget "WP" (list pt1 pt2 pt3 pt4) (list (cons 0 "Text,mtext"))))
    ; replace (list pt1 pt2 pt3 pt4) with say (setq newlst (pts returned from pline vertex's))
    (setq ss (ssget "WP" newlist (list (cons 0 "Text,mtext"))))
    ;then foreach or repeat x times
    (setq ans (entget (ssname ss x))) 
    (setq handle (assoc 5 ans))
    (setq text (assoc 2 ans) ; need different for mtext walk line by line
    PS your dwg has the text etc twice in some cases.
    A man who never made mistakes never made anything

  3. #3
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    Mar 2013
    Posts
    23

    Default

    Thanks for your reply 'BIGAL'.
    Although i have been a CAD design draughtsman for many years i am on very unfamilar ground with this. What is 'ssget'? What is a point from pline routine?

    The text isn't quite duplicated, what the drawing depicts is cable baskets at different levels. The numbers are all the same but fo one digit.

    Thanks, for your help :-)

  4. #4
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,745

    Default

    The code example by me is lisp code.

    You need a programming language to do what you want hence the example in lisp you can use VBA .Net C## maybe even a Autocad macro to do what you want.

    Have you written any programs ? Do you have basic lisp skills ? Because you posted the lisps you are using I assumed that you understood how to write programs.

    Ssget is "get a selection set of objects" the you can drill down and retrieve the properties of the object such as the vertices that make up a pline.

    Using "WP" this is within a ploygon so it will only search within a certain area, "X" is complete drawing

    cons 0 "text" is a filter only look for text objects used with "X" it would every bit of text in your drawing

    adding cons 8 "Connections" would mean search within polygon for text objects on layer "Connections"
    A man who never made mistakes never made anything

  5. #5
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    Mar 2013
    Posts
    23

    Default

    Thanks for the explantions.
    No i haven't written any programs at all. I downloaded the lisp files from this site.
    I think i need to look for a "dummies" guide to writing lisp scripts?!
    I have a feeling it will take me a considerable amount of time to write what i need so i may have to resort to doing it the long winded way!

  6. #6
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,745

    Default

    Its not that hard its just a case of getting the two or 3 programs you need and glueing them together you have the first two you need a 3rd which is what I was hinting at.

    So you want the polygon x,y points and the text within thats ok why do you want the handle ? Also when you get all this info how do you really want it exported as a CSV file, simple column text file or straight into excel etc

    The rtos is exporting 8 decimals do you need that many ?

    Code:
    (setq pnt (trans pnt 0 1));;**CAB
    ;at this point you would do a CONS to make a list of all the points in that pline and then use it in the ssget
    A man who never made mistakes never made anything

  7. #7
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    Mar 2013
    Posts
    23

    Default

    I was thinking that i could extract the handle and associate that with the text, as some of the text in my other drawings doesn't sit within the confinds of the polygon.
    I need it in a simple .csv file so that i can import it into a software database.

    What is rtos?

  8. #8
    Super Member Tyke's Avatar
    Computer Details
    Tyke's Computer Details
    Operating System:
    Windows 7 - 64 bit, W8 + W8.1 Vista
    Computer:
    HP Z400 Workstation
    CPU:
    Intel(R) Xeon(R) CPU W3530 @ 2.80GHz
    RAM:
    8 GB
    Graphics:
    Nvidia Quadro 600 1GB DDR3
    Primary Storage:
    2x 500GB HDD RAID 1 and Western Digital 2TB NAS RAID 1
    Secondary Storage:
    Lacie external HDD 2TB Raid Level 1
    Monitor:
    Samsung SyncMaster P2770HD, 2443 and 193T
    Discipline
    Multi-disciplinary
    Tyke's Discipline Details
    Occupation
    Surveyor, programmer, civil engineer
    Discipline
    Multi-disciplinary
    Details
    Surveying and civil engineering. As built utilities surveys and data maintenance in GIS systems. Building surveys, measured and laser scanning. Setting out of all civil works. Control and settlement surveys. Programming in AutoCAD, MicroStation, Geograf and stand alone applications for all uses.
    Using
    Civil 3D 2014
    Join Date
    Jun 2006
    Location
    Saxony, Germany
    Posts
    1,397

    Default

    Quote Originally Posted by Drafty View Post
    What is rtos?
    rtos = real to string. It's a LISP function that converts a real number into a string.
    Engage brain before mouth

    "The German who types with a Yorkshire accent" - Dave Broada 2o1o

  9. #9
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,745

    Default

    Your changing the rules text outside now, do you just want all text drawn on a single layer and its xy ? this is easy.

    Code:
    (setq ss (ssget "X" (list (cons 0 "Text,mtext")(cons 8 "mylayer"))))
    A man who never made mistakes never made anything

  10. #10
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    Mar 2013
    Posts
    23

    Default

    Registered forum members do not see this ad.

    I give up. I simply don't understand how to do it. Thanks all for your help.

Similar Threads

  1. Extracting xyz coordinates from 3d polylines
    By 1ridgey in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 13th Apr 2012, 02:08 am
  2. How to do this handle????
    By stevep80 in forum AutoCAD 3D Modelling & Rendering
    Replies: 8
    Last Post: 3rd Jan 2012, 08:08 pm
  3. extracting cursor coordinates
    By rusty in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 29th Jun 2006, 10:30 am

Tags for this Thread

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