See the top rated post in this thread. Click here

Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Schedules

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

    Default Re: Schedules

    I think were on a different page is I ssget random blocks some have attributes some dont, then I make a block table counting common blocks via there name & attribute values hence the door1 can have a gold handle or a silver handle. The table is made to suit the maximum attribute number in the selection set. It currently uses the block name and 1st attribute, I need to expand it further. Like always need time.

    door1 silver 22
    door1 gold 16

    the test list
    (("qqqq" "1stT" "2nd" "d1") ("qqqq" "1stT" "2nd" "d3") ("qqqq" "1stT" "2nd" "d1") ("qqqq" "1stT" "2nd" "3rd") ("BBB" "c") ("BBB" "D") ("BBB" "c") ("BBB" "c") ("BBB" "c") ("BBB" "D") ("BBB" "c") ("aaa" "B" "B") ("aaa" "A" "B") ("aaa" "B" "B") ("aaa" "A" "B") ("aaa" "B" "B") ("aaa" "A" "B") ("aaa" "B" "B") ("aaa" "A" "B") ("aaa" "B" "B") ("aaa" "A" "B") ("aaa" "B" "B") ("aaa" "A" "B") ("REVTABLE" "1" "1" "1") ("DA1DRTXT" "PRELIMINARY DRAWING" "" "" "PA" "" "" "" "" "" "" "" "" "" "" "ARBITRARY" "ARBITRARY" "Bill T.dwg" "MELWAY" "" ""))

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

    Default Re: Schedules

    Quote Originally Posted by BIG-AL View Post
    I think were on a different page is I ssget random blocks
    some have attributes some dont,
    I haven't tested my function for that but it could be easily changed to do that.

    I was thinking that the first attribute (or no attributes) would also be a desirable function.

    Since the functions do a schedule on ALL blocks first and then filter out those that do not meet the
    wildcard filters it should be possible to change it to include first attributes and no attributes.

    The way I create the full (every block) list of sublists might be like this.

    Code:
    (list (list "BLOCKNAME" "Door")(list "HANDLECOLOR" "Silver"))
          (list "BLOCKNAME" "Door2")(list "HANDLECOLOR" "Gold")(list "FINISH" "OAK") )
          (list "BLOCKNAME" "DoorSym")(list "DOORNUMBER" "1"))
          (list "BLOCKNAME" "Column")
         ...
    )
    The code could easily be changed to allow for a selection set instead of a full modelspace count.

    Can you post your test drawing for me to test it on?

    P=
    AutomateCAD

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

    Default Re: Schedules

    I modified the code to create a schedule of symbols (filtered by wildcard string),
    created by selection set (but including nested blocks)
    and to include a specified number of attributes.

    Can you think of any other way to do a schedule?

    Once we have the schedule... We can talk about creating dialogs and tables.

    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 with attributes 
    ;___________________________________________________________________________________________________________|
    ;
    ; Command Line Function Header List
    ;___________________________________________________________________________________________________________|
    
    ;* C:BFAS
    ;* Command Line Function to output a list quantity of and block names and attributes
    
    ;* C:BlockFirstAttributeSchedule
    ;* Command Line Function to output a list quantity of and block names and attributes
    
    ;___________________________________________________________________________________________________________|
    ;
    ; General Function Header List 
    ;___________________________________________________________________________________________________________|
    
    ;  Function, Arguments and Description
    
    ;* (BlockFirstAttributeSchedule strWCBlockName strWCTagString)
    ;* Function to create a list of sublists of block counts from a wildcard string filter and number of attributes
    
    ;* (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.
    
    ;* (BlockSublistLengthSet lstSublist intAttributes)
    ;* Function to deduct or add to sublist for specified number of attributes
    
    ;* (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
    AutomateCAD

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

    Default Re: Schedules

    Thank you for your effort I will have a play with it over weekend. The test dwg was just something I randomly made with blocks like aaa bbb etc and having different number of attributes. I may look at a more recurvise way of treating the list of blocks sort on block name then 1st attribute then group and split on 2nd attribute and so on.

    Please try this on one of your dwg's would appreciate the feed back.

    Code:
    ;  Take a block atts and make them into a table 
    ; counting the blocks also
    ; by Alan H April 2018
    
    (defun AH:block-atts ( / x  k obj obj2 ans ans2 comparelems AH:gotable)
    
    (defun  AH:gotable (  / txt)
    (setq rownum (vla-get-rows obj2))
    (vla-InsertRows obj2  rownum  (vla-GetRowHeight obj2 (- rownum 1)) 1)
    (repeat (setq k (length ans))
    (setq txt  (nth (setq k (- k 1)) ans))
    (vla-settext obj2 rownum  k  txt)
    )
    (vla-settext obj2 rownum   (- numcols  1) (rtos tot 2 0))
    (setq tot 1)
    )
    
    (defun comparelems (  / )
    (if (and
    (= (nth 0 ans)(nth 0 ans2))
    (= (nth 1 ans)(nth 1 ans2))
    )
    (setq tot (+ tot 1))
    (AH:gotable )
    )
    )
    
    (setq lst '())
    (setq ss (ssget '((0 . "insert"))))
    
    (repeat (setq  x (sslength ss))
    (setq lst2 '())
    (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
    (if (and (vlax-property-available-p obj "hasattributes")
    (setq atts (vlax-invoke obj "getattributes"))
    )
    (progn
    (setq lst2 (cons (vla-get-EffectiveName obj) lst2))
    (foreach att atts
    (setq lst2 (cons (vla-get-textstring att) lst2))
    )
    (setq lst (cons (reverse lst2) lst))
    )
    )
    )
    
    ; sorts on 1st two items
    (setq lst (vl-sort lst '(lambda (x y)
    (cond
    ((= (cadr x)(cadr y))
    (< (car x)(car y)))
    ((< (cadr x)(cadr y)))
    ))))
    
    (setq  numcols 1)
    (repeat (setq  x (length lst))
    (setq len (length (nth (setq x (- x 1)) lst)))
    (if (> len  numcols)
    (setq  numcols  len)
    )
    )
    (setq numcols (+ len 1))
    
    ; add better pick
    (setq obj2 (vlax-ename->vla-object (car (entsel "pick table or any other object to create a table"))))
    (if (/= (vla-get-objectname obj2) "AcDBtable")
    (progn
    (if (not AH:table_make)(load "table create2"))
    (AH:table_make  numcols)
    (setq obj2 (vlax-ename->vla-object (entlast)))
    )
    (princ)
    )
    
    (setq x 0)
    (setq tot 1)
    (setq ans (nth x lst))
    (repeat (- (length lst) 1)
    (setq ans2 (nth (setq x (+ x 1)) lst))
    (comparelems)
    (setq ans ans2)
    )
    )
    (AH:block-atts)
    Code:
    ; example of creating a table using passed variables
    ; By Alan H July 2017
    ; sum of column row 10 column 1 ie 2nd column 
    ; (vla-settext obj 10 1 "=sum(B2:B7)") 
    ; get number of rows
    ; (vla-get-rows obj)
    ; get number of columns
    ; (vla-get-columns obj)
    ; insert a row add only 1 row newrownum +1 to number of rows
    ; (vla-InsertRows obj newrownum (vla-GetRowHeight obj rownum) 1)
    
    (defun AH:table_make (numcolumns  / numrows curspc colwidth numcolumns numrows objtable rowheight sp doc)
    (vl-load-com)
    (setq sp (vlax-3d-point (getpoint "Pick lower left"))); or use getpoint
    (setq doc  (vla-get-activedocument (vlax-get-acad-object) ))
    
    (if (= (vla-get-activespace doc) 0)
    (setq  curspc (vla-get-paperspace doc))
    (setq curspc (vla-get-modelspace doc))
    )
    
    (setq numrows 2)
    (setq rowheight 0.5)
    (setq colwidth 30)
    (setq objtable (vla-addtable curspc sp numrows numcolumns rowheight colwidth))
    (vla-settext objtable 0 0 "TABLE title")
    ;(vla-settext objtable 1 1 "B") 
    ;(vla-settext objtable 1 2 "C")
    ;(vla-settext objtable 1 3 "D")
    
    (vla-setcolumnwidth objtable 0 30) ; 0 is first column
    (vla-setcolumnwidth objtable 1 30)
    (vla-setcolumnwidth objtable 2 60)
    (command "_zoom" "e")
    (princ)
    )

Page 2 of 2 FirstFirst 12

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
  •