Romero Posted March 9, 2018 Posted March 9, 2018 First of all, I want to thank each of the users that with their great help I have been able to learn a little about Lisp. I hope and some of you can help me with this code to add the total length of dynamic blocks that have a stretch parameter. Basically the code works well; asks the user to enter the name of the parameter and then performs its function. There is a problem: if I select other dynamic blocks that have another parameter by name, it does not work; I would like to be able to solve that problem. Any ideas? I would also like it to be repeated multiple times and that the previous user's entry be saved for the name of the parameter. I hope it's not too much to ask. From Mexico I thank you very much, and I apologize for my English, which is not very good. I will be very grateful if someone can help me. ;Suma en bloques dinamicos: Indicando el nombre del parametro ;Solo seleccionar bloques dynamicos que tengan ese parametro (vl-load-com) (defun c:SUMBD (/ total selectionset count intger selectionsetname obj AR) (setq AR (getstring t "\nNOMBRE PARAMETRO: ")) (defun LM:getdynpropvalue ( blk prp ) (setq prp (strcase prp)) (vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (vlax-get x 'value))) (vlax-invoke blk 'getdynamicblockproperties) ) ) (if (setq total 0 selectionset (ssget '((0 . "INSERT") (-4 . "<or") (2 . "`*U*") (2 . "_P1000") (-4 . "or>") ) ) ) (progn (setq count (sslength selectionset)) (repeat (setq intger (sslength selectionset)) (setq selectionsetname (ssname selectionset (setq intger (1- intger)) ) obj (vlax-ename->vla-object selectionsetname) total (+ total (LM:getdynpropvalue obj AR) ))) (alert (strcat " CANTIDAD TOTAL DE BLOQUES DYNAMICOS :" "< " (itoa count) " >" "\n" " LONGITUD TOTAL EN BLOQUES DYNAMICOS :" "< " (rtos total 2) " >" ) ) ) (princ) ) (princ) ) Quote
Tharwat Posted March 9, 2018 Posted March 9, 2018 Basically the code works well; asks the user to enter the name of the parameter and then performs its function. There is a problem: if I select other dynamic blocks that have another parameter by name, it does not work; I would like to be able to solve that problem. Any ideas? Hi, The following should give you a push forward. (if (setq total 0 selectionset (ssget '((0 . "INSERT")(2 . "`*U*,_P1000")))) (progn (setq count (sslength selectionset)) (repeat (setq intger (sslength selectionset)) (setq selectionsetname (ssname selectionset (setq intger (1- intger)))) (if (= (vla-get-EffectiveName (vlax-ename->vla-object selectionsetname)) "_P1000") ( ;; .............. Quote
Romero Posted March 10, 2018 Author Posted March 10, 2018 The following should give you a push forward. Thank you very much Tharwat for your appreciable help. Analyze the code and try to solve the routine. I thank you very much and thank you for taking part of your time to help. Quote
Tharwat Posted March 10, 2018 Posted March 10, 2018 Its my pleasure Romero and you are welcome anytime. 1 Quote
sameerp27@gmail.com Posted February 8, 2021 Posted February 8, 2021 Hi, How do I use above program for final use? Quote
rkmcswain Posted February 8, 2021 Posted February 8, 2021 9 hours ago, sameerp27@gmail.com said: Hi, How do I use above program for final use? See this >> Quote
Recommended Posts
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.