See the top rated post in this thread. Click here

Page 1 of 3 123 LastLast
Results 1 to 10 of 28

Thread: writing a LISP to automate daily practice

  1. #1
    Member
    Join Date
    2020-04
    Posts
    11
    Login to Give a bone
    0

    Exclamation writing a LISP to automate daily practice

    Hi all and thanks for stopping by

    I am looking for some help in writing a lisp to automate a daily task that takes a big time and effort.

    as a daily practice, I receive a survey DWG file from the surveyor of an archaeology project, however, the survey drawing consists of separate points that have an ID, elevation, and coordinates text.
    my work flow consists from the following:

    1 first I turn off the coordinates layer because I do not need this info
    2 I select all text elements in drawing and run Scaletext command and set the value to 0.004
    3 I edit the "point" block by actually drawing the point and deleting the two perpendicular lines in the block
    4 then I save the edits and select all the same block by running QS command, then I explode them.
    5 later to that I go for one point, select the point ID text and copy it
    6 then I go into QS, choose text, and put the parameter to wildcard match, input the copied point ID text into the field and add an "*" at the end
    7 then I go into the drawing and select manually the point element and the elevation text related to the selection made in the previous step
    8 by that I have selected all the points, point ID text, and elevation text which are all related to one feature\element surveyed.
    9 now I make a new layer and name it with the text copied in step 5
    10 and put all the selected elements in step 8 on that layer, I turn it off and lock it
    11 then I repeat all the above steps for the remaining features\elements

    now I have finished the "sorting" part.

    then I turn on all layers and unlock them. then I go into each layer, isolate it, and connect the points by drawing a line between each two points
    for this part I found online a LISP that automatically draw lines between points based on their name depending it have sequence (which it have)

    is it possible to automate the whole work flow described above?? or is there any easier more time-saving method to deal with this??

    thank you, and looking forward to hearing your thoughts

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    0

    Default Re: writing a LISP to automate daily practice

    Quote Originally Posted by majou789377 View Post
    Hi all and thanks for stopping by

    I am looking for some help in writing a lisp to automate a daily task that takes a big time and effort.

    as a daily practice, I receive a survey DWG file from the surveyor of an archaeology project, however, the survey drawing consists of separate points that have an ID, elevation, and coordinates text.
    my work flow consists from the following:

    1 first I turn off the coordinates layer because I do not need this info
    2 I select all text elements in drawing and run Scaletext command and set the value to 0.004
    3 I edit the "point" block by actually drawing the point and deleting the two perpendicular lines in the block
    4 then I save the edits and select all the same block by running QS command, then I explode them.
    5 later to that I go for one point, select the point ID text and copy it
    6 then I go into QS, choose text, and put the parameter to wildcard match, input the copied point ID text into the field and add an "*" at the end
    7 then I go into the drawing and select manually the point element and the elevation text related to the selection made in the previous step
    8 by that I have selected all the points, point ID text, and elevation text which are all related to one feature\element surveyed.
    9 now I make a new layer and name it with the text copied in step 5
    10 and put all the selected elements in step 8 on that layer, I turn it off and lock it
    11 then I repeat all the above steps for the remaining features\elements

    now I have finished the "sorting" part.

    then I turn on all layers and unlock them. then I go into each layer, isolate it, and connect the points by drawing a line between each two points
    for this part I found online a LISP that automatically draw lines between points based on their name depending it have sequence (which it have)

    is it possible to automate the whole work flow described above?? or is there any easier more time-saving method to deal with this??

    thank you, and looking forward to hearing your thoughts
    1. Easy
    2. That scale value works for all text in the drawing? Are you converting units of some kind?
    3. Save the modified block somewhere and have the lisp redefine it in each new drawing.
    4. Not sure what you trying to do but as a rule I avoid exploding block insertions. Guessing what you need is to modify or add some attributes.

    If you could post a link to before and after drawings and describe any needed unit conversions it might be easier to help you.

  3. #3
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    555
    Login to Give a bone
    0

    Default Re: writing a LISP to automate daily practice

    if your surveyor supplied you a CSV file of the points X,Y,Z,description the you can do all sorts of things like have a block for each description, or just use correct block in 1st place. Agree with Tom do a redefine of the block.

    Re the joining points this is what I refer to as spaghetti as that is what it looks like if you get it wrong, I have been doing feature survey adjusts for like 40 years so understand what you want. Ok the quick answer CIV3D or Stringer by Civil Survey Solutions, the latter may be cheaper and does much more than pts and lines.. If you do a multi level sort of your points you end up with points that have say the same description but are sorted in surveyed order. Then can be auto joined making lines.

    Like Tom if you can supply a CSV of points and a before - after dwg can make better comments for a solution. The preferred csv would be ptnumber, X, Y, Z, Description.

    eg
    200,338725.774,6008196.374,101.284,RTK2
    201,338725.319,6008193.161,101.292,RTK2
    202,338725.331,6008192.495,101.289,RTK2
    203,338725.528,6008182.497,101.248,RTK2
    204,338725.725,6008172.498,101.206,RTK2
    205,338725.922,6008162.5,101.164,RTK2
    206,338726.118,6008152.502,101.122,LTK2
    207,338726.319,6008142.31,101.08,LTK2
    208,338726.554,6008140.324,101.064,LTK2
    209,338728.274,6008132.541,100.997,LTK2
    210,338728.948,6008102.548,100.892,LTK2

  4. #4
    Member
    Join Date
    2020-04
    Posts
    11
    Login to Give a bone
    0

    Default Re: writing a LISP to automate daily practice

    thank you guys for your thoughts

    I recieve a DWG from the surveyour.
    and no unit conversion needed.

    - - - Updated - - -




    this is a before image

    - - - Updated - - -


    this is an after image

    - - - Updated - - -

    Quote Originally Posted by Tom Beauford View Post
    1. Easy
    2. That scale value works for all text in the drawing? Are you converting units of some kind?
    3. Save the modified block somewhere and have the lisp redefine it in each new drawing.
    4. Not sure what you trying to do but as a rule I avoid exploding block insertions. Guessing what you need is to modify or add some attributes.

    If you could post a link to before and after drawings and describe any needed unit conversions it might be easier to help you.
    - I explode the block because it contains a "point" element and I need the point element to correspond to the Point Type I choose for the drawing.
    I need to automate the steps described, with minimal input needed from me as a user. is it possible?

    - - - Updated - - -

    Quote Originally Posted by Tom Beauford View Post
    1. Easy
    2. That scale value works for all text in the drawing? Are you converting units of some kind?
    3. Save the modified block somewhere and have the lisp redefine it in each new drawing.
    4. Not sure what you trying to do but as a rule I avoid exploding block insertions. Guessing what you need is to modify or add some attributes.

    If you could post a link to before and after drawings and describe any needed unit conversions it might be easier to help you.

    this will sound weird, but I scale the text objects in the drawing (it is only the point ID and Elevation), because I need them to be visible but not disturbing, so I keep it to a minimum, it just happens that value 0.004 works.
    Last edited by majou789377; 2021-04-21 at 07:27 AM.

  5. #5
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,096
    Login to Give a bone
    0

    Default Re: writing a LISP to automate daily practice

    Instead of using the surveyor's drawing directly, you could insert the supplied drawing into a prepared template drawing of your making. This template drawing could have the point blocks as you want with the attributes scaled to your preference. By inserting the surveyor's drawing into this template, the blocks included in the template that match the same names from the surveyor's drawing, the template blocks would hold priority to the block definition.

    That may reduce some of the time and manual processing you are currently doing with less need for as much automation.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  6. #6
    Member
    Join Date
    2020-04
    Posts
    11
    Login to Give a bone
    0

    Default Re: writing a LISP to automate daily practice

    Quote Originally Posted by Opie View Post
    Instead of using the surveyor's drawing directly, you could insert the supplied drawing into a prepared template drawing of your making. This template drawing could have the point blocks as you want with the attributes scaled to your preference. By inserting the surveyor's drawing into this template, the blocks included in the template that match the same names from the surveyor's drawing, the template blocks would hold priority to the block definition.

    That may reduce some of the time and manual processing you are currently doing with less need for as much automation.
    Thanks for this. However, I doubt it may have any real impact on the case.
    the block contains only two perpendicular lines in yellow that indicates a point location. the point ID and Elevation are not attributes, they are separate elements and placed on separate layers, Point ID = layer "PT_ID", and Elevation = Layer "HEIGHT"
    the idea of a drawing template is good, I am not sure how to make it work in light of the above given info.

  7. #7
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    0

    Default Re: writing a LISP to automate daily practice

    Quote Originally Posted by majou789377 View Post
    - I explode the block because it contains a "point" element and I need the point element to correspond to the Point Type I choose for the drawing.
    I've seen those in blocks like that as well and the "point" element was scaled same as the block which seemed weird. I edited the block and deleted the point as it was in the exact position as the block insert it didn't seem to serve a purpose anyway.

    Opie's suggestion with that modified block should help. The coordinates and elevation are probably already the same as the block insertion. The block name would be more difficult but could be extracted with code if it's always in the same position relative to the block insertion.

    Attaching a drawing instead of a photo would allow us to help you better.

    Adding a signature that includes what software and version you're using helps everyone provide answers specific to your needs. We may have a completely different answer if you had Civil 3D 2021.
    Last edited by Tom Beauford; 2021-04-12 at 03:50 PM. Reason: Signature Suggestion

  8. #8
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,096
    Login to Give a bone
    0

    Default Re: writing a LISP to automate daily practice

    If the blocks have an elevation other than 0.00 assigned to it, then the coordinates can be determined by the block insertion. The only information not included with the block would be the name to the upper left, per your image. This could then be automated using AutoLISP or other programming language.

    As Tom mentions, sample drawings (original and modified) could help others that are willing to help here in the forums. The entire original or modified drawings are not necessary, just a sample of the similar areas.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  9. #9
    Member
    Join Date
    2020-04
    Posts
    11
    Login to Give a bone
    0

    Default Re: writing a LISP to automate daily practice

    Quote Originally Posted by Opie View Post
    If the blocks have an elevation other than 0.00 assigned to it, then the coordinates can be determined by the block insertion. The only information not included with the block would be the name to the upper left, per your image. This could then be automated using AutoLISP or other programming language.

    As Tom mentions, sample drawings (original and modified) could help others that are willing to help here in the forums. The entire original or modified drawings are not necessary, just a sample of the similar areas.
    Yes I would love to get some help and learn better ways. I am currently doing my best but it is not enough.
    I already attached the original to a previous reply to Tom, and here I attach the modified.

    - - - Updated - - -

    you can notice in the modified version that I have separate layers for each group of points that share the same ID. I rename the layer after part of the point ID, which is "cutxxx" followed by date in form yyyymmdd. which I also do manually and individually for each layer.
    is there a way to incorporate this in a better practice method??

    - - - Updated - - -

    it may be worth mentioning, that I just recently started using the bellow command to drawa the lines. before I used to it manually

    (setq
    ss (ssget '((0 . "POINT")))
    n -1
    )
    (command "_.line")
    (while (setq ent (ssname ss (setq n (1+ n))))
    (command (cdr (assoc 10 (entget ent))))
    )
    (command "")
    Last edited by majou789377; 2021-04-21 at 07:25 AM.

  10. #10
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    0

    Default Re: writing a LISP to automate daily practice

    Quote Originally Posted by majou789377 View Post
    indeed the insertion point for all that is same.

    attached is the file in question.
    Sorry, not comfortable working with Student Version drawings.

Page 1 of 3 123 LastLast

Similar Threads

  1. daily occurrence --> ADT2005 "re-install"
    By markjnstne in forum CAD Management - General
    Replies: 2
    Last Post: 2004-08-06, 04:03 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
  •