Making Dynamic blocks

Making Dynamic blocks

Anonymous
Not applicable
872 Views
3 Replies
Message 1 of 4

Making Dynamic blocks

Anonymous
Not applicable

Hi all,

 

I'm having a few questions about dynamic blocks.

I need to make a dynamic block with rectangle, using lisp or visual lisp. 

User suppose to be able to stretch one point of rectangle(lower right).

Can you please give me some advice or examples, because I don't have any experience about making dynamic blocks, and there is not a lot of information's about dynamic blocks on forum.

 

Thank you for time and consideration,

dicra

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

Lee_Mac
Advisor
Advisor

To my knowledge, it is not possible to create dynamic blocks using AutoLISP or Visual LISP, as the functionality was never exposed to the LISP API. It is only possible to manipulate existing dynamic blocks using Visual LISP.

 

Lee

Message 3 of 4

hmsilva
Mentor
Mentor

Hi dicra,

 

in addition to the previously stated by Lee, and only as a 'demo', we can 'make' a DynBlock using command calls.

As a demo, start a new dwg, load this code, and type demo.

 

(defun c:demo nil
  (command "_-bedit" ".")
  (command "_.rectang" "0,0" "1,1")
  (command "_zoom" "_O" "_L" "")
  (command "_zoom" "0.5x")
  (command "_BParameter" "Point" "1,0" "1.5,0" 1)
(command "_BActionTool" "sTretch" "1.5,0" "1.25,-0.25" "0.75,0.75" "1.0,0.3" "")
  (command "bsaveas" "test_h")
  (command "bclose")
  (command "-insert" "test_h" "_S" 1 "0,0" "")
  (command "_zoom" "_O" "_L" "")
  (princ)
)

 

Hope that helps

Henrique

 

 

EESignature

Message 4 of 4

Anonymous
Not applicable

Lee, Henrique,

 

Thank you for answers.

Looks like my first question suppose to be, is it possible to make dynamic blocks with AutoLISP or Visual LISP.

I founded that it is not possible to use entmake for dynamic blocks, but I was hopping that it is possible to do that with Visual LISP.

 

Now I am using normal blocks in routine.

I will try to accomplish my task  by saving dynamic block in supporter search path and inserting it to the drawing. Now it looks to me better than using commands calls in routine.

 

My routine is looping and adding +1 to the block name, until it finds that there is not any  blocks in the drawing, or block definition in table.

Something like this:

 

(setq i 0)
(setq blckname "MyBlock")
(while (not (or (not(tblsearch "BLOCK" blckname))
(not (ssget "_X" (list (cons 2 blckname))))
)
)
(setq i (1+ i))
(setq blckname (strcat "MyBlock" "-" (rtos i 2 0)))
)

 

Is it good idea to make something like this for dynamic block, to loop trough tablesearch and to clone dynamic block, which I want to insert, to the new one with name of block which does not exist in the drawing.

Later I will need to get dimensions from rectangle which one is in dynamic block.

 

The another solution for me is, just to make polyline with extended data. But my block suppose to have attributes, and it is going to be easier for user to change attribute values than to change extended data, whit custom command which I need to make.

 

I would really appreciate your advice for my problem.

 

 

dicra

 

 

0 Likes