See the top rated post in this thread. Click here

Page 1 of 6 12345 ... LastLast
Results 1 to 10 of 52

Thread: Lisp Legend

  1. #1
    Member
    Join Date
    2017-10
    Location
    Florida
    Posts
    26
    Login to Give a bone
    0

    Default Lisp Legend

    I have a lisp that creates a legend based on active blocks in the drawing, it uses an external text file to check block names and populates the legend. I need to modify the lisp. We are transitioning from using blocks to description keys. Is there a way to do something like tblnext with cogo points based on the point style?

    for example this line would cycle through the blocks
    Code:
     (setq bname (cdr (assoc 2 (setq blist (tblnext "BLOCK" T)))))
    the lisp then checks bname against the external file and if it appears in the list it adds the symbol and text to the legend.
    I need to do the same but based on the point style of the cogo point.

    Code:
    (setq ptStyle (VLAX-GET c3ddoc 'pointstyle))
    I was thinking that this might be a start.

  2. #2
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    2

    Default Re: Lisp Legend

    Hi,

    Here is a good start for you to continue with.

    Code:
    (defun CollectBlockNamesFromTextFile (/ textfile openFile blockName BlockNames)
      (if (and (setq textfile (getfiled "Select the text file that has the block names." "" "txt" 16))
               (setq openFile (open textfile "r"))
               )
        (progn
          (while (setq blockName (read-line openFile))
               (setq BlockNames (cons blockName BlockNames))
               )
             (close openFile)
          )
        )      
      BlockNames
    )
    ;;								;;
    (if (setq lst (CollectBlockNamesFromTextFile))
      (while (setq obj (tblnext "BLOCK" (not obj)))
        (if (member (cdr (assoc 2 obj)) lst)
          (
           ;; do your stuff here	;;
           )
          )
        )
      )

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

    Default Re: Lisp Legend

    As you want a legend for cogo points you need to inspect the actual points in the dwg, we have around 200+ point styles as these match our field coding, a typical dwg uses a very small amount of these.

    So you need to go through the points I am not sure if there is a "style in use" for the point styles which would be the quickest way. It may be a property of the point style will try to find some time to look .
    Code:
    (setq pdks (vlax-get-property *AeccDoc* 'pointdescriptionkeysets))
    (setq ptstys (vlax-get-property *AeccDoc* 'PointStyles))
    (setq ptlabstys (vlax-get-property *AeccDoc* 'PointLabelStyles))

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

    Default Re: Lisp Legend

    Ok had a quick look
    Primary point group : Points
    Point Number : 5652
    Northing : 5770864.717m
    Easting : 284671.443m
    Point Elevation : 62.356m
    Raw Description : TR
    Full Description : TREE
    Description Format : TREE
    Style : TR
    Point Label Style : None
    Survey Point : False

    So the point has a description point style of TR which has a block for a tree what you want for your legend. I think your stuck with going through the points and make a list of codes. Its a bit of pain as you have to keep looking into the styles for the block. I would go the path of a text file with stylenane blockname per line much easier.

    Not a quick to code.
    Last edited by BIG-AL; 2017-12-18 at 07:46 AM.

  5. #5
    Member
    Join Date
    2017-10
    Location
    Florida
    Posts
    26
    Login to Give a bone
    0

    Default Re: Lisp Legend

    Thanks everyone for the input. I'm going to try your suggestions and report back.

  6. #6
    Member
    Join Date
    2017-10
    Location
    Florida
    Posts
    26
    Login to Give a bone
    0

    Default Re: Lisp Legend

    How would one search the point styles? I know how to select a point and "Get" the pointstyle from it. Would I select all the points in the drawing with the following?
    Code:
    (setq selPnts (ssget "x" '((0 . "AECC_COGO_POINT"))))
    How would I get the point style from the points after selecting them and them cycle through? Would creating a list of the points work? then comparing the point style to the block name list?

    kind of thinking out loud.
    Last edited by _brxdvs; 2017-12-18 at 03:48 PM.

  7. #7
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    1

    Default Re: Lisp Legend

    Quote Originally Posted by _brxdvs View Post
    How would one search the point styles?
    Hi,

    Copy and paste the following codes into your AutoCAD command line then you would prompt to select an entity, so select a point to see the related DXF codes and from that list you should be able to see the style name within that list and it is may start with 2 or 3 not sure because I have not used Civil3D at all before.

    Code:
    (if (setq e (car (entsel "\nSelect point object :")))
      (foreach x (entget e) (print x))
      )
    After selecting the point object hit F2 to enlarge the Window Text screen of your AutoCAD and to see the DXF codes.

  8. #8
    Member
    Join Date
    2017-10
    Location
    Florida
    Posts
    26
    Login to Give a bone
    0

    Default Re: Lisp Legend

    Tharwat

    this is what I got from AutoCAD
    Command:
    Code:
    (if (setq e (car (entsel "\nSelect point object :")))
    (_>   (foreach x (entget e) (print x))
    (_>   )
    Select point object :
    (-1 . <Entity name: 7ff7646304a0>)
    (0 . "INSERT")
    (330 . <Entity name: 7ff7646551f0>)
    (5 . "46A32")
    (100 . "AcDbEntity")
    (67 . 0)
    (410 . "Model")
    (8 . "U-VLT")
    (100 . "AcDbBlockReference")
    (2 . "VLT")
    (10 22840.7 48241.6 0.0)
    (41 . 20.0)
    (42 . 20.0)
    (43 . 20.0)
    (50 . 0.0)
    (70 . 0)
    (71 . 0)
    (44 . 0.0)
    (45 . 0.0)
    (210 0.0 0.0 1.0) (210 0.0 0.0 1.0)
    This looks like the thing I am looking for
    (2 . "VLT")
    Last edited by rkmcswain; 2018-01-19 at 01:20 PM. Reason: added [CODE] tags

  9. #9
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Lisp Legend

    That is a block reference or point object?

    If its a block reference as it is clear from the return of the codes then just use these codes to select all block references with the same name:

    Code:
    (setq ss (ssget "_X" '((0 . "INSERT")(2 . "VLT"))))
    Last edited by Tharwat; 2017-12-18 at 05:58 PM.

  10. #10
    Member
    Join Date
    2017-10
    Location
    Florida
    Posts
    26
    Login to Give a bone
    0

    Default Re: Lisp Legend

    I selected a cogo point. It has description keys applied. in this case it is a vault (VLT). It appears that (2 . "VLT") is the point style.

Page 1 of 6 12345 ... LastLast

Similar Threads

  1. Replies: 5
    Last Post: 2016-01-10, 04:44 PM
  2. Replies: 7
    Last Post: 2014-05-15, 03:00 PM
  3. Tags in Legend Views / Tag legend components
    By Wish List System in forum Revit Architecture - Wish List
    Replies: 0
    Last Post: 2012-11-14, 07:08 AM
  4. Replies: 3
    Last Post: 2012-05-07, 08:16 PM
  5. Copy / Paste from Legend to Legend
    By antman in forum Revit Architecture - General
    Replies: 5
    Last Post: 2011-04-12, 03:22 PM

Tags for this Thread

Posting Permissions

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