Jump to content

Lisp: dynamic blocks management fail


MastroLube

Recommended Posts

Hi there,

 

I'm developing a simple program to draw shear reinforcement but I have some problems with my blocks.

They are four: rectangular column, circular column, wall end and wall corner).

 

The problem is that i need to draw the control section around them and that makes my blocks unpredictable while controlling them by lisp.

 

I filled my rectangular block with tons of cosntrains and that makes it slow (and sometime unpredictable).

I've tried other solution but still not found the way to avoid it. For exemple i have to make a ._regen after each change with other blocks.

 

(DEFUN inserisci_prop_dyn (/) ;this funcion will change the dynamic proprieties
(putdynpropvalue obj "d" d) ; it changes the offset of the control section from the column/wall


 (COND ((= NOME_PIL "Pilastro Rettangolare") ; rectangular column

        
(COMMAND "_.regen")
        (putdynpropvalue obj "c1" c1) ;width

        ;(COMMAND "_.regen")
        (putdynpropvalue obj "c2" c2) ; height
        ;(COMMAND "_.regen")
        (putdynpropvalue obj "cb1" c1) ; it makes even the line that controls the distance from the edge of the slab with the width
        (putdynpropvalue obj "cb2" c1) ; for edge column there are 2 parameters for that
        
        (putdynpropvalue obj "cs1" c1) ;this is the same concept but for the edge column 
        (putdynpropvalue obj "cs2" c2) 
        (putdynpropvalue obj "cs3" c1) ;cs3 and cs4 are for interior edge column 
        (putdynpropvalue obj "cs4" c2)
        
        (putdynpropvalue obj "ang_rot" ang_rot) ;that change the rotation of the block
        

       )
       ((= NOME_PIL "Pilastro Circolare") ;circular column
        (COMMAND "_.regen")
        (putdynpropvalue obj "c1" c1)
        (putdynpropvalue obj "cb1" (/ c1 2))
        (putdynpropvalue obj "cb2" (/ c1 2))
        
        (putdynpropvalue obj "cs1" (/ c1 2))
        (putdynpropvalue obj "cs2" (/ c1 2))
        (putdynpropvalue obj "cs3" (/ c1 2))
        (putdynpropvalue obj "cs4" (/ c1 2))
        
        
        
        (putdynpropvalue obj "ang_rot" ang_rot)
       )
       ((= NOME_PIL "Angolo Interno") ;wall edge
        (putdynpropvalue obj "c1" c1)
        (putdynpropvalue obj "c2" c2)
        (COMMAND "_.regen")
        (SETQ a (/ (* 1.5 d) 100)
              b (/ (* 1.5 d) 100)
        )
        (putdynpropvalue obj "a" a)
        (putdynpropvalue obj "b" b)
        (putdynpropvalue obj "ang_rot" ang_rot)
        (COMMAND "_.regen")
       
       )
      ((= NOME_PIL "Fine Parete") ;wall end
        (putdynpropvalue obj "c1" c1)
        ;(putdynpropvalue obj "c2" c2)
        (SETQ a (MIN c1 (- (* 3 d) (* 0.5 c1)))
              b (MIN c1 (- (* 3 d) (* 0.5 c1)))
        )
        (putdynpropvalue obj "a" a)
        (putdynpropvalue obj "b" b)
        (putdynpropvalue obj "ang_rot" ang_rot)
       )
 )
 (putdynpropvalue obj "Vista" vista) ;each block can fit each situation: interior, edge, corner. With this line I'll set the right position
 
 (COMMAND "_.regen")
 
 ;(IF (AND (= nome_pil "Fine Parete") (= stato_inversione 1)) ;just to flip it, don't mind about that now
 ;  (toggleflipstate obj)
 ;  )
   
)

 

I'll write there the function "putdynpropvalue":

 

;;put dynamic property by property name
(DEFUN putdynpropvalue (obj name value / props names)
 (SETQ props (VLAX-INVOKE obj 'getdynamicblockproperties)
       names (MEMBER name (MAPCAR 'VLA-GET-PROPERTYNAME props))
 )
 (VLAX-PUT (NTH (- (LENGTH props) (LENGTH names)) props) 'Value value)
)   

 

I've asked in my language forum (i'm from italy) for help but I did't receive any.. :(

 

I'm new to dynamic blocks, maybe I did some mistakes.. Can someone tell me how to fix that situation?

 

Pilastro Rettangolare.dwg this is the rectangular column, have a look of it and you will understand the code

 

Thanks,

Dennis

Link to comment
Share on other sites

Hello again!

In order to make it more clear, I've recorded a short video of the problems I have with my blocks. As you can see the wall end is totally bugged and the rectangular column needs a lot of time to get insert in the drawing (and has some problem).

 

Fine Parete.dwg

 

 

Any advice?

 

Thanks, Dennis

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...