• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

management dynamic blocks through lisp: errors

  • Thread starter Thread starter Dr.Lube
  • Start date Start date

Dr.Lube

Guest
Bye to all,
I had written on an English forum (cadtutor) in hope someone could help me. .

I try to turn to you too, hoping to have more luck! :

as someone of you will know I am developing a small program that makes me check to punch and draws my ligatures.

what I do is go insert a block according to the support to check.
I have therefore 4 great categories: rectangular pillar, circular pillar, fine wall and inner corner. each of these has different views to cover all possible cases (e.g. rectangular pillar: inside, edge, outer corner, inner corner).

the only way not to "discover" the rectangle pillar block was to fill it with geometric constraints. this has made sure that the insertion of the block requires a lot of time, over 5 times the time to insert the circular one (in the video is very evident). Despite all constraints, the block is still unstable when I go to change it manually.

the instability of the wall end block is something absurd.. once he went now he stopped going.. Boh!

Maybe the problem is in the lisp?
Code:
(defun insert_prop_dyn (/) ;function to change dynamic parameters
(putdynpropvalue obj "d" d) ; imposed static height, the control perimeter is done
; twice d


(cond ((= name_pil " rectangular pillar");


(command "_.regen")
(putdynpropvalue obj "c1" c1)

;(command "_.regen")
(putdynpropvalue obj "c2" c2); height
;(command "_.regen")
(putdynpropvalue obj "cb1" c1); in the first line makes the two parameters that identify the distance from the edge equal to the sides
(putdynpropvalue obj "cb2" c1) ;

(putdynpropvalue obj "cs1" c1) ;same speech but for the distance of the edge from the edge
(putdynpropvalue obj "cs2" c2)
(putdynpropvalue obj "cs3" c1) ;cs3 and cs4 are of the internal angle pillar
(putdynpropvalue obj "cs4" c2)

(putdynpropvalue obj "ang_rot" ang_rot) ;change block rotation


)
((= name_pil "circular pillar")
(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)
)
((= name_pil "internal angle")
(putdynpropvalue obj "c1" c1)
(putdynpropvalue obj "c2" c2)
(command "_.regen")
(setq a (/* 1.5 d) 100)
(* 1.5 d) 100
)
(putdynpropvalue obj "a" a)
(putdynpropvalue obj "b" b)
(putdynpropvalue obj "ang_rot" ang_rot)
(command "_.regen")

)
((= name_pil "end wall")
(putdynpropvalue obj "c1" c1)
;(putdynpropvalue obj "c2" c2)
(setq a (min c1 (-* 3 d) (* 0.5 c1)))
(* 0.5 c1))
)
(putdynpropvalue obj "a" a)
(putdynpropvalue obj "b" b)
(putdynpropvalue obj "ang_rot" ang_rot)
)
)
(putdynpropvalue obj "view" view) ; with this parameter I put the view corresponding to the situation

(command "_.regen")

;(if (and = name_pil "end wall") (= state_inversion 1)) ; in the case of end wall of edge I need to mirror the block
; (toggleflipstate obj) ; to cover all cases
;

)
The regens I put serve not to blow up the block. Maybe someone can be eliminated.
Code:
;put dynamic property by property name
(defun putdynpropvalue (obj name value / props names)
(setq props (vlax-invoke obj 'getdynamicblockproperties)
names (member name)
)
(vlax-put (nth (-length props) (length names) props) 'value value'
)
below are the two blocks under review:View attachment Fine Parete.dwg
View attachment Pilastro Rettangolare.dwgand to finish a video to understand exactly the problem:[video]https://youtu.be/xjiymwzdluq[/video]Thank you very much.
dennis
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top