I have to setup many dynamic block properties, in many blocks (autoLISP)

I have to setup many dynamic block properties, in many blocks (autoLISP)

costin.calin
Participant Participant
889 Views
3 Replies
Message 1 of 4

I have to setup many dynamic block properties, in many blocks (autoLISP)

costin.calin
Participant
Participant

Hello, 

I have 6-8 dy props to setup in 100-1000 blocks. For 10-15 blocks takes a half minute.

I use a LeeMac function.

(defun LM:setdynprops ( blk lst / itm )
    (foreach x (vlax-invoke blk 'getdynamicblockproperties)
        (if (setq itm (assoc (vla-get-propertyname x) lst))
            (vla-put-value x (vlax-make-variant (cadr itm) (vlax-variant-type (vla-get-value x))))
        )
    )
)

It works very good in most programs, but now when I have many props/block it's slow down.

 

I need a solution, like

-extract in a list the etire structure ?!

-externly: I modify this where I need

-put etire structure in one move like (setq...

 

  1. Exist a specific LISP(VL VLA or else) function who can do that with entire struct
  2. Or other way to order myprops and use one secvential scan of block DyProps and change it

 

I have same problem with a table with ~10 colomns. When the table is grater than ~20lines, slow down, and down

For 50 lines work 1hour.

I use to write in table, for example (vla-settext myTable i j txt)

Thank you

 

0 Likes
890 Views
3 Replies
Replies (3)
Message 2 of 4

CodeDing
Advisor
Advisor

@costin.calin,

 

I am somewhat confused by your request. Can you clarify please? It sounds like you are retrieving all dynamic properties of a block, then placing them into a table?

Can you provide an example?

 

Best,

~DD

0 Likes
Message 3 of 4

rapidcad
Collaborator
Collaborator

Is this regarding all properties changing values slowly, or are you finding that only block property tables are causing your slow changing property values?

 

I have found that with block property tables, I find it best to write a function to figure out which line in the table should be set and I just set Block Table1 to whatever integer is the line (first table line is 0)

This tends to speed up the process a lot in some drawings, but not enough in big drawings in my opinion.

Here is a simple snippet of one as an example:

(progn
  (cond
    ((= widval1 "16\"")(setq TABLENUM 0))
    ((= widval1 "22\"")(setq TABLENUM 1))
    ((= widval1 "28\"")(setq TABLENUM 2))
    ((= widval1 "34\"")(setq TABLENUM 3))
    ((= widval1 "40\"")(setq TABLENUM 4))
    ((= widval1 "46\"")(setq TABLENUM 5))
    ((= widval1 "52\"")(setq TABLENUM 6))
    )
  (Setq dbpl (list
         (list "Block Table1" TABLENUM)
         (list "typ_spacer_lower" (strcat spacrtyp2 " SPACERS"))
         (list "lower_control" spacrtyp)
         (list "prd_mods" "No")
        )
          )
  )

I'm not using Lee's program to push the dynamic block property values into the properties, I'm using some of his ideas along with Mark Douglas' code, so I can pass a list of lists to my function and set each property to its proper value - that is what I am doing in the code above - making a list to set a fairly simple block property table.

 

I have seen the times for applying changes like this grow radically when the drawing gets full of dynamic blocks.

One solution is to work in smaller drawings, maybe X-referencing them together.

 

If anyone knows of a faster way to set Block Property Table values, I'm all ears.

ADN CAD Developer/Operator
0 Likes
Message 4 of 4

costin.calin
Participant
Participant

I have two stages soft for that design.

 

step 1. the computer decide its design. That means many DyBlocks are copied and modified. Its decide is fast, but the drawing that(copy and modify DyBK) is slow.

 

human stage. The human designer verfify and modify.

 

step 2. Calculate required material (fast) and write in a table(slow when is over 20-30 lines)

0 Likes