Insert block without regenerating in AutoLISP

Insert block without regenerating in AutoLISP

ShricharanaB
Advocate Advocate
751 Views
7 Replies
Message 1 of 8

Insert block without regenerating in AutoLISP

ShricharanaB
Advocate
Advocate

Hi, 

 

I'm inserting a lot of blocks using AutoLISP. The function (Rotblock2 by L. Minardi, thank you! ) uses command "_insert" and all inputs calculated by the code automatically. and UCS is being changed to rotate the block after insertion.

What happens now is, the inserted block is shown then rotation and movement is shown in the drawing before the next block is added. If the blocks are complicated, they need a lot more time to add since it has to show it in the drawing before moving on to the next.

Is there a possible way to not show each block while it is being inserted?

Edit: The blocks are to be added > rotated to the proper orientation > Dynamic parameters and attributes changed.

so that I can regen the drawing once after the code completes with all the blocks inserted. 

0 Likes
Accepted solutions (1)
752 Views
7 Replies
Replies (7)
Message 2 of 8

Sea-Haven
Mentor
Mentor
Accepted solution

Look into 2 options use entmake or VLA-INSERTBLOCK. 

Message 3 of 8

ShricharanaB
Advocate
Advocate

Hi @Sea-Haven,

I tried VLA-INSERTBLOCK and doesn't seem to have any difference from _insert apart from converting all variables into variants to feed into  VLA-INSERTBLOCK. I can still see each block being added. I've turned off AutoRegen variable though I don't think it has to do anything with this. And entmake is much too complicated to figure out right now for the blocks. 

Here are the steps : Add block at point > rotate to required angle > change attributes(edit: change attributes and dynamic parameters) > move on to the next block to add, repeat.

I can still see each step happening for each block when I run the code.

 

0 Likes
Message 4 of 8

Moshe-A
Mentor
Mentor

@ShricharanaB ,

 

it's not clear why you are using a lisp program to insert a blocks. you say you are using dragmode for the position + rotation and edit attributes. in this case (inserting blocks) automation is effective when less is intervention, where the scale + rotation + attributes value are know.

 

about regenauto 🤔  i think it is less influencing compares to old versions. set dragmode to 1 or 0.

 

Moshe

 

Message 5 of 8

ShricharanaB
Advocate
Advocate

Hi @Moshe-A,

 

All the above steps I've mentioned are done through code automatically. None of it is manual. I'm not using dragmode to insert. 

Turns out rotating each block before adding the next block would show the added block when using vla-insertblock. So I've switched to vla-insertblock and adding all the blocks  at once. then I'm adding them to an selectionset and rotating the blocks all at once. This is saving time while adding the blocks,

but...

 

Changing the parameter value is disabled for now since I'm using some array parameters inside the block they take a lot of time to regenerate after using vla-put-value for each block dynamic parameter. Not sure if this can be done for all blocks at once. Can it?

 

Note: - The rotation of blocks using rotate3d is needed because the blocks are oriented horizontally (needed for dynamic parameters) and they need to be inserted in vertical position. vla-insertblock only asks for angle on xyplane.

0 Likes
Message 6 of 8

Moshe-A
Mentor
Mentor

@ShricharanaB ,

 

Ok

 

Note that inserting block with [vla-insertBlock or (entmake/x)] is only enought for block without Attributes definitely not for dynamic blocks 😀

 

Moshe

 

 

Message 7 of 8

ShricharanaB
Advocate
Advocate
Yes, I'm using Lee Mac's setdynparampvalue function to change dynamic parameter values.
0 Likes
Message 8 of 8

ShricharanaB
Advocate
Advocate

@Moshe-A @Sea-Haven 

So, for changing dynamic property values it seems that if I do it in a loop it will take more and more time to change the length of the next block which takes a very long time. For now I'm resorting to changing dyn prop of one block and the using vl-copy to copy that block to replace the rest. 

0 Likes