See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Schedules

  1. #1
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,106
    Login to Give a bone
    1

    Default Schedules

    One of the most common requests on the forums is creating schedules of symbols.

    There are many opinions on how to do this so I thought I would cook some examples (the way I see it)

    The first example is one that just counts blocks and creates a schedule to the text screen.

    One thing I think is important that others frequently do not handle is what if a symbol is nested inside another block.

    This example handles that condition.

    I was wondering if some of you might try it and comment before I post more examples...

    P=

    Code:
    ;___________________________________________________________________________________________________________|
    ;
    ; Written By: Peter Jamtgaard C.E., P.E., S.E. copyright 2018 All Rights Reserved
    ;___________________________________________________________________________________________________________|
    ;
    ; Any use by unauthorized person or business is strictly prohibited.
    ;___________________________________________________________________________________________________________|
    ;
    ; Abstract: This set of functions are created to demonstrate how to make block schedules 
    ;___________________________________________________________________________________________________________|
    ;
    ; Command Line Function Header List
    ;___________________________________________________________________________________________________________|
    
    ;* C:BlockSchedule
    ;* Command Line Function to output a list quantity of and block names to the text screen (in modelspace)
    
    ;___________________________________________________________________________________________________________|
    ;
    ; General Function Header List 
    ;___________________________________________________________________________________________________________|
    
    ;  Function, Arguments and Description
    
    ;* (BlockDefinition objBlockReference)
    ;* Function to get the block definition of a block reference
    
    ;* (BlockSchedule strWCBlockName)
    ;* Function to create a list of sublists of block counts from a wildcard string filter
    
    ;* (BlockScheduleRecursive objBlockDefinition)
    ;* Function to iterate through a block definition counting blocks (recursive)
    
    ;* (ErrorTrap symFunction)
    ;* Function to trap errors. Returns value or T for success and nil for failure
    
    ;* (StringCompress lstStrings)
    ;* Function to compress a list of strings into list of sublists including count and block name (twice) 
    
    ;* (TextFormat strString intWidth strRightorLeft)
    ;* Function to set text length (to intWidth characters) and justify text "R" or "L"
    
    ;* (ToObject value)
    ;* Function to convert a vla-object, entitynames, entsels, elists, handles or objectid's to a vla-object.
    
    ;$ Header End
    
    See attachment for code
    
    (vl-load-com)
    Attached Files Attached Files
    Last edited by peter; 2018-05-26 at 12:11 PM.

  2. #2
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,106
    Login to Give a bone
    1

    Default Re: Schedules

    I think there was a question about scheduling blocks with attributes.

    It took a little longer and there is a lot of list manipulation to develop a composite list of attribute tagstrings...

    So before we talk about tables and their structure I created this routine to make a schedule that includes attribute values.

    Long attribute values or tagstrings can cause wordwrap issues...

    So enter the block wildcard string, the tag string wildcard string and you get a printout to the textscr that schedules blocks and attribute values.

    So check it out and tell me if it works for you...



    Code:
    ;___________________________________________________________________________________________________________|
    ;
    ; Written By: Peter Jamtgaard C.E., P.E., S.E. copyright 2018 All Rights Reserved
    ;___________________________________________________________________________________________________________|
    ;
    ; Any use by unauthorized person or business is strictly prohibited.
    ;___________________________________________________________________________________________________________|
    ;
    ; Abstract: This set of functions are created to demonstrate how to make block schedules with attributes 
    ;___________________________________________________________________________________________________________|
    ;
    ; Command Line Function Header List
    ;___________________________________________________________________________________________________________|
    
    ;* C:BAS
    ;* Command Line Function to output a list quantity of and block names to the text screen (in modelspace)
    
    ;* C:BlockSchedule
    ;* Command Line Function to output a list quantity of and block names to the text screen (in modelspace)
    
    ;___________________________________________________________________________________________________________|
    ;
    ; General Function Header List 
    ;___________________________________________________________________________________________________________|
    
    ;  Function, Arguments and Description
    
    ;* (BlockAttributeSchedule strWCBlockName strWCTagString)
    ;* Function to create a list of sublists of block counts from a wildcard string filter for blockname and tagstring
    
    ;* (BlockAttributeTagstringBlend lstOfSublists lstTagStrings)
    ;* Function to create a list of sublists tagstrings for all blocks in table
    
    ;* (BlockAttributeTagStringList lstOfSublists)
    ;* Function to create a full list of all tagstrings in the output
    
    ;* (BlockDefinition objBlockReference)
    ;* Function to get the block definition of a block reference
    
    ;* (BlockFormatLine lstOfStrings)
    ;* Function to format a line of the report from a list of strings
    
    ;* (BlockHandleScheduleRecursive (objBlockDefinition)
    ;* Function to iterate through a block definition counting blocks (recursive) returns a list of handles
    
    ;* (BlockHandleToSublist strHandle)
    ;* Function to develop a list of sublists including blockname and tagstrings with values from a block.
    
    ;* (ErrorTrap symFunction)
    ;* Function to trap errors. Returns value or T for success and nil for failure
    
    ;* (ListOfSublistsColumnsSort lstOfSublists)
    ;* Function to sort the columns of the tagstring values in the output
    
    ;* (ListofSublistsSortbyItem lstOfSublists intItem)
    ;* Function to sort a list of sublists in ascending order by a specific item in list (0 indexed) 
    
    ;* (SublistCompress lstStrings)
    ;* Function to compress a list of sublists to include count, block name and attribute values 
    
    ;* (TextFormat strString intWidth strRightorLeft)
    ;* Function to set text length (to intWidth characters) and justify text "R" or "L"
    
    ;* (ToObject value)
    ;* Function to convert a vla-object, entitynames, entsels, elists, handles or objectid's to a vla-object.
    
    ;$ Header End
    See attachment for code.
    Attached Files Attached Files
    Last edited by peter; 2018-05-26 at 12:06 PM.
    AutomateCAD

  3. #3
    Member
    Join Date
    2010-10
    Location
    Việt Nam
    Posts
    45
    Login to Give a bone
    0

    Default Re: Schedules

    Oh, did you missed Errortrap and toobject functions ? I saw it somewhere in some of your last posts. Hmmm. Finding ...

    Found it, right ?
    It worked and thanks to your functions
    Code:
    ;___________________________________________________________________________________________________________
    ; 
    ; Function to Trap Errors in LISP Expressions
    ;___________________________________________________________________________________________________________
    
    (defun ErrorTrap (symFunction / objError result)
     (if (vl-catch-all-error-p
          (setq objError (vl-catch-all-apply
                         '(lambda (XYZ)(set XYZ (eval symFunction)))
                          (list 'result))))
      nil
      (if result result 'T)
     )
    )
    
    (defun ToObject (value / symType) 
     (setq symType (type value))
    ; Vla-Object
     (if (= symType 'vla-object)                
      value
    ; Entity Name
      (if (= symType 'ENAME)                     
       (vlax-ename->vla-object value)
    ; Handle
       (if (and (= symType 'STR)
                (setq value (handent value))         
                (entget value))                   
        (toobject value)
    ; EntSelection
        (if (and (= symType 'LIST)
                 (= (type (car value)) 'ENAME))    
         (toobject (car value))
    ; Entity List
         (if (and (= symType 'LIST)
                  (= (type (car value)) 'LIST)                                                 
                  (= (type (cdar value)) 'ENAME)     
             )                                      
          (toobject (cdar value))
    ; Object ID
          (if (and (= symType 'INT)
                   (= (strlen (itoa value)) 10))
           (errortrap (quote (vla-objectidtoobject 
                              (vla-get-activedocument 
                               (vlax-get-acad-object)) 
                              value
                             )
                      )
           )
          )
         )
        )
       )
      )
     )
    )

  4. #4
    Member tuomo.jarvinen's Avatar
    Join Date
    2015-09
    Location
    Jyväskylä, Finland
    Posts
    49
    Login to Give a bone
    0

    Default Re: Schedules

    Found that missing, too. Now it works!

  5. #5
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,106
    Login to Give a bone
    1

    Default Re: Schedules

    I corrected the two routines below to add those two functions.

    Sometimes I forget to put toolbox functions into the code... That is why I ask for you guys to check it.

    It really helps you guys crash testing my posts...

    I want to continue this thread and try to solve ALL of the problems with schedules once and for all.

    I want to hear from you all, on what you need schedules to do and I will try to put it in here too.

    P=
    Last edited by peter; 2018-05-26 at 12:19 PM.
    AutomateCAD

  6. #6
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,106
    Login to Give a bone
    0

    Default Re: Schedules

    I plan to talk about tables after we get through the scheduling stuff...

    Any other ideas?

    p=
    AutomateCAD

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

    Default Re: Schedules

    I think a few of us are doing variations on the same theme, I just jumped into output to table as 1st step, it counts blocks etc as well as infilling the attribute details. I am working on something like data extraction that you can make a data file so only populate desired attributes. The data file will be manual txt file or via list dcl to add or modify. Another option now solved is an image of the block in the table as well. Lastly would be a excel link.

    It uses a double sort on the attribute lists so as to support multi level attributes, door1 gold, door1 silver etc rather than just door1.

    The 1st test stage works select random blocks a table is produced. But I want to add extra stuff before posting.

  8. #8
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,106
    Login to Give a bone
    0

    Default Re: Schedules

    Quote Originally Posted by BIG-AL View Post
    I think a few of us are doing variations on the same theme, I just jumped into output to table as 1st step, it counts blocks etc as well as infilling the attribute details. I am working on something like data extraction that you can make a data file so only populate desired attributes. The data file will be manual txt file or via list dcl to add or modify. Another option now solved is an image of the block in the table as well. Lastly would be a excel link.

    It uses a double sort on the attribute lists so as to support multi level attributes, door1 gold, door1 silver etc rather than just door1.

    The 1st test stage works select random blocks a table is produced. But I want to add extra stuff before posting.
    Hey AL,

    What are you trying to do with the attributes?

    Are you using only one attribute or many?

    (The functions I wrote include multiple attributes)

    My first thought is a set of functions that create the list of sublists for the schedule.

    Then exporting to text files, creating tables, etc... would each be a separate set of functions.

    If you do a search for TableMagic in this forum you will find a program that has the dialog
    you mentioned and creates schedules (not recursive) that I posted 10 years ago

    http://forums.augi.com/showthread.ph...AE-Table-Magic

    I was going to re-write them in my modern style and post them individually so others could use them without much modification...

    Peter
    Last edited by peter; 2018-05-29 at 01:37 AM.
    AutomateCAD

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

    Default Re: Schedules

    Once I started looking at this more other variations appeared, my 1st go handles multiple attributes, doing a sort on two attributes could be pushed further, so a block multiple times will be counted not based on name only. The list of sublists is done just uses a simple vl-sort. Then just compare looking for changing patterns. As suggested Block=Door att1 =gold. other block, name =Door att1 = silver so it would count all doors but seperate into two seperate block counts gold or silver independant output is to a table.

    I will look a lot further into the code you have provided as well as the link, I started my attempt as a response to a post on cadtutor and have since found lots of answers. I have my reasons at this stage to not post code.

    As a side note 30+ years with lisp 10+k posts at Cadtutor so very respectful of others with great knowledge and always learning.

    Code:
    ; sorts on 1st two items
    ; in this code block name att1
    (setq lst (vl-sort lst '(lambda (x y)
    (cond
    ((= (cadr x)(cadr y))
    (< (car x)(car y)))
    ((< (cadr x)(cadr y)))
    ))))

  10. #10
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,106
    Login to Give a bone
    0

    Default Re: Schedules

    This is my sort function for lists of sublists.

    Rather than just sorting the first item, it can sort the nth item.

    It is a standard toolbox function for me.

    P=

    Code:
    ;___________________________________________________________________________________________________________|
    ;
    ; Function to sort a list of sublists in ascending order by a specific item in list (0 indexed) 
    ;___________________________________________________________________________________________________________|
    
    (defun ListofSublistsSortbyItem (lstOfSublists intItem)
     (vl-sort lstOfSublists '(lambda (X Y) (< (nth intItem X) (nth intItem Y))))
    )
    AutomateCAD

Page 1 of 2 12 LastLast

Similar Threads

  1. Key Schedules - Added Project Parameter not Available in other Key Schedules
    By lhanyok in forum Revit Architecture - General
    Replies: 4
    Last Post: 2012-09-14, 03:31 PM
  2. Create Schedules, View and Add circuits to panel schedules in a linked file.
    By autocad.wishlist1734 in forum Revit MEP - Wish List
    Replies: 0
    Last Post: 2011-10-10, 12:17 PM
  3. Schedules
    By tonyv in forum Revit - Platform
    Replies: 7
    Last Post: 2010-01-15, 01:37 PM
  4. Take off Schedules
    By amindez9667 in forum Revit Architecture - General
    Replies: 1
    Last Post: 2009-05-01, 03:54 PM
  5. 8.1/N - Opposite of Key Schedules - Sub Schedules - O
    By janunson in forum Revit Architecture - Wish List
    Replies: 2
    Last Post: 2005-09-01, 08:54 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
  •