See the top rated post in this thread. Click here

Results 1 to 8 of 8

Thread: issues understanding text definitions in LISP routine

  1. #1
    Member
    Join Date
    2020-07
    Posts
    14
    Login to Give a bone
    0

    Default issues understanding text definitions in LISP routine

    I'm using the following as part of an automated suite of LISPS to label, place and orient text annotations:


    Code:
    (defun DTextEntMake ( TxIN Ang2 Tx cst / )	
     (setq lay (strcat lay "_txt"))
      (entmake
       (list
       '(0 . "Text")
       (cons 7 "OPA_DEPTH_TEXT")
       (cons 40 0.35)
       (cons 8 lay)
       (cons 1 Tx)
       (cons 10 TxIN)
       (cons 50 ang2)
       )
      )
    (command "chprop" "l" "" "a" "y" "")
    )
    So I flip text around inside the other routines without having to have two separate insertion point references, for ends of line etc, and to help passing text objects from CAD into e.g.QGIS, I wanted to use a middle-centre definition for the text, so I assumed the following would change it:


    Code:
    (defun DTextEntMake ( TxIN Ang2 Tx cst / )	
     (setq lay (strcat lay "_txt"))
      (entmake
       (list
       '(0 . "Text")
       (cons 7 "OPA_DEPTH_TEXT")
       (cons 40 0.35)
       (cons 8 lay)
       (cons 1 Tx)
       (cons 10 TxIN)
       (cons 50 ang2)
       (cons 72 1)
       (cons 73 2)
       )
      )
    (command "chprop" "l" "" "a" "y" "")
    )
    The rest of the cons values are being generated elsewhere. but when I use this version, defining 72 and 73, the text is now drawing at 0,0,0 at 0 degrees instead of using the insertion point and orientation it should. It seemed like a no brainer to alter the cons list values to achieve what I wanted, obviously not.
    Last edited by Opie; 2020-08-04 at 02:48 PM. Reason: [code] tags added

  2. #2
    Member
    Join Date
    2020-07
    Posts
    14
    Login to Give a bone
    0

    Default Re: issues understanding text definitions in LISP routine

    add: just ran it again with a different data set and it is using the angle for orientation but it's drawing the text at 0,0,0.

  3. #3
    Active Member
    Join Date
    2015-12
    Location
    Western Europe
    Posts
    57
    Login to Give a bone
    1

    Default Re: issues understanding text definitions in LISP routine

    Unless your text is justified left, fit +1 other, the position is controlled by dxf code 11, so stick (cons 11 TxIN) between (cons 72..) and (cons 73..). Leave (cons 10 TxIN) there and Autocad will recalculated it.

  4. #4
    Member
    Join Date
    2020-07
    Posts
    14
    Login to Give a bone
    0

    Default Re: issues understanding text definitions in LISP routine

    TY

    I didn't realise the list would be syntax dependant, with the order of the constructed list dxf attributes changing the behaviour of the expression. Do you know any references that I could read that would explain this type of syntax rule/effect? Awesome that you've given me the answer, the fact that I don't understand why that is the answer is getting in the way of me growing my abilities.

  5. #5
    Active Member
    Join Date
    2015-12
    Location
    Western Europe
    Posts
    57
    Login to Give a bone
    1

    Default Re: issues understanding text definitions in LISP routine

    I just follow the syntax in the AutoCAD2012 DXF Reference HERE. It's a pdf and downloadable. I not sure if the order is relevant, but I tend to stick to it in case it is. If something has a default option (linetype = continuous, textstyle = standard etc) you can omit them and the default will be assumed.

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

    Default Re: issues understanding text definitions in LISP routine

    Viewable online AutoCAD 2021 DXF Reference: http://help.autodesk.com/view/ACD/20...3-38A2306D73F3
    Viewable online AutoCAD 2000 DXF Reference: https://www.autodesk.com/techpubs/au.../dxf/index.htm

  7. #7
    Login to Give a bone
    0

    Default Re: issues understanding text definitions in LISP routine

    Hi,

    thanks for sharing it.it solves all my doubt.it is very useful one.

  8. #8
    Member
    Join Date
    2020-07
    Posts
    14
    Login to Give a bone
    0

    Default Re: issues understanding text definitions in LISP routine

    Thanks guys. Yeah I was confused initially as I thought the order of the list construction wouldn't matter, originally I just stuck the 70's at the end of the list so I could edit it a little easier later but that's where my issue was. Thanks as well for the pointers.

Similar Threads

  1. Replies: 3
    Last Post: 2017-11-17, 06:06 PM
  2. Lisp routine in a Lisp routine
    By jayhay35365091 in forum AutoLISP
    Replies: 8
    Last Post: 2013-10-09, 02:30 PM
  3. Run Lisp Routine From Another Lisp Routine
    By mwilson in forum AutoLISP
    Replies: 7
    Last Post: 2013-07-25, 02:46 PM
  4. Need Help Understanding Attached Lisp
    By sumulong in forum AutoLISP
    Replies: 6
    Last Post: 2011-01-14, 03:25 AM
  5. Replies: 2
    Last Post: 2007-05-11, 11:25 AM

Posting Permissions

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