See the top rated post in this thread. Click here

Results 1 to 9 of 9

Thread: Predefined List

  1. #1
    Active Member
    Join Date
    2007-02
    Location
    Calgary, Alberta, Canada
    Posts
    73
    Login to Give a bone
    0

    Exclamation Predefined List

    What I am trying to do is decide which titleblock to insert based on user input while my LISP is running.


    Example:

    There are a list of clients (we'll call them AB12, BCH4, LKRI7).

    I want to prompt the user with a list of the clients and then enter the first two letters (and/or give them a drop down list to choose from). They could pick the client's full name from the drop down or type in "AB", "BC", etc.

    The user input would be stored into a variable (tbclient).

    When my LISP inserts the titleblock, it would check the variable (tbclient) and then insert the proper titleblock.


    Any ideas?

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    1

    Default Re: Predefined List

    Give this a try Mike:

    Code:
    (defun c:TEST (/ clientName)
      (setvar 'cmdecho 0)
      (initget "A B L")
      (if
        (setq clientName (getkword "\nEnter Client [Ab12/Bch4/Lkr17]<Ab12>: "))
        T
        (setq clientName "A"))
      (cond
        ((= "A" clientName)
          (command "._-insert" "A_blockName" "insertPoint" "blockScale" "" 0))
        ((= "B" clientName)
          (command "._-insert" "B_blockName" "insertPoint" "blockScale" "" 0))
        ((= "L" clientName)
          (command "._-insert" "L_blockName" "insertPoint" "blockScale" "" 0)))
      (setvar 'cmdecho 1)
      (princ)) ;_end defun
    Notes -
    • The blocks should reside within your system's support pathing.
    • The insertPoint can be predefined, e.g. '(0 0 0).
    • The blockScale can be predefined, e.g. 1.
    Last edited by RenderMan; 2010-07-14 at 03:32 PM. Reason: Clean up command line -> 'cmdecho
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    1

    Default Re: Predefined List

    It's always best practice to keep whatever you've fed to initget the same as the provided choices.

    eg.
    [Ab12/Bch4/Lkr17]

  4. #4
    Active Member
    Join Date
    2007-02
    Location
    Calgary, Alberta, Canada
    Posts
    73
    Login to Give a bone
    0

    Default Re: Predefined List

    Thanks guys! Works great!

    Now I have another problem...well, not really a problem, just an annoyance because I like to keep my code clean. I am inserting a titleblock with 82 attributes in it, so I have the text for each attribute set as a variable (to make it easy to insert in multiple titleblocks).

    Here is the command and it works great:

    Code:
    ((= "BI" clientName)
          (command "-insert" "J:/CAD/2010-Mechanical/Templates/P&ID Templates/Borders/birchcliff.dwg" "0,0,0" 1 "" "" i7 
      i6 i4 i3 i2 i1 i5 i9 i8 i26 i17g 
      i17f i17e i17d i17c i17b i17a i16g i16f i16e i16d 
      i16c i16b i16a i15g i15f i15e i15d i15c i15b i15a 
      i14g i14f i14e i14d i14c i14b i14a i13g i13f i13e 
      i13d i13c i13b i13a i12g i12f i12e i12d i12c i12b 
      i12a i11g i11f i11e i11d i11c i11b i11a i10g i10f 
      i10e i10d i10c i10b i10a i25b i25a i24b i24a i23b 
      i23a i22b i22a i21b i21a i20b i20a i19b i19a i18b 
      i18a))
    I have 14 instances of the above code right now (14 different clients). Anyways, I was thinking something like this would clean it up, but it fails to use the list of attributes and use them when inserting the titleblock:

    Code:
    (setq inscmds (list i7 
      i6 i4 i3 i2 i1 i5 i9 i8 i26 i17g 
      i17f i17e i17d i17c i17b i17a i16g i16f i16e i16d 
      i16c i16b i16a i15g i15f i15e i15d i15c i15b i15a 
      i14g i14f i14e i14d i14c i14b i14a i13g i13f i13e 
      i13d i13c i13b i13a i12g i12f i12e i12d i12c i12b 
      i12a i11g i11f i11e i11d i11c i11b i11a i10g i10f 
      i10e i10d i10c i10b i10a i25b i25a i24b i24a i23b 
      i23a i22b i22a i21b i21a i20b i20a i19b i19a i18b 
      i18a))
    
    ((= "BI" clientName)
          (command "-insert" "J:/CAD/2010-Mechanical/Templates/P&ID Templates/Borders/birchcliff.dwg" "0,0,0" 1 "" "" inscmds))

  5. #5
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Predefined List

    Code:
    (apply 'command (append (list "_.-insert" "J:/CAD/2010-Mechanical/Templates/P&ID Templates/Borders/birchcliff.dwg" '(0 0 0) 1 "" "") inscmds))

  6. #6
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Predefined List

    However, this would probably be a lot easier if you just inserted the block, then stepped through the attributes and assigned them accordingly.

  7. #7
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Predefined List

    Just curious... if you have so many title block attributes to populate (among a multitude of other reasons), why not just use the Sheet Set Manager (SSM)?

    You can modify the custom project properties once (for the entire project), instead of sheet by sheet. I mean if you want to automate, then take it all the way!

    Note -
    This requires converting the attributes to fields, and associating the sheets with the SSM.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  8. #8
    Active Member
    Join Date
    2007-02
    Location
    Calgary, Alberta, Canada
    Posts
    73
    Login to Give a bone
    0

    Default Re: Predefined List

    The reason is that we've been using our old titleblocks for a few years and we've recently changed them drastically.

    I've linked the old attributes (since they're already populated) to the new attributes using variables and now i'm inserting the new titleblock and re-populating it with the attributes from the old titleblock. The entire process takes less than a second.

    See linked video I just took:
    https://webmail.tundraeng.com/~mikef...07-14_1227.mp4

  9. #9
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Predefined List

    OMG! Another MS-TB, you know of course it makes life soooo dificult having your TB's in MS don't you? You might just want to modify that lisp so it creates a new Tab for the TB, then moves it into PS using CHSpace. You'll thank yourself in the long run, I promise!

Similar Threads

  1. Workshare with predefined rooms
    By Wish List System in forum Revit Architecture - Wish List
    Replies: 0
    Last Post: 2012-04-10, 07:12 PM
  2. 2012: Predefined notes on titleblocks
    By Ddubya in forum Revit Architecture - General
    Replies: 3
    Last Post: 2012-01-12, 08:29 AM
  3. Predefined rebar on beams?
    By JotaG in forum Revit Structure - Families
    Replies: 0
    Last Post: 2010-01-18, 11:56 AM
  4. Predefined Hatch
    By robert.armstrong in forum Software
    Replies: 1
    Last Post: 2008-08-13, 06:35 PM
  5. Predefined text strings
    By robert.1.hall72202 in forum AutoCAD Customization
    Replies: 2
    Last Post: 2007-07-12, 08:17 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
  •