Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/22/2021 in all areas

  1. I would just add the read lisp to the bottom of your lips and use the call function to read out the attribute. rather then trying to modify it to only read "first_pos" "PropertyName" and "Value" are like the dxf codes headers So its looking at each "PropertyName" in the block until it equals "first_pos" then what ever that "Value" it's set curval Yes its possible I would have to look at your code to see how your selecting the block. If your using ssget would be something like (getdynprop (ssname SS #) "first_pos") if your using something like (setq x (entsel )) (getdynprop x "first_pos") This is just a simple lisp. (defun C:FPOS (\ ss pos) (if (setq SS (ssget "_X" '((0 . "INSERT") (2. "console")))) (foreach x (mapcar 'cadr (ssnamex SS)) (setq pos (getdynprop x "first_pos")) (if (setq npos (getstring (strcat "\nChange Value of POS <" pos ">: ")) (chgdynprop x "first_pos" npos) ) ) ) ) ;have the read variable & change variable lisp loaded When they type FPOS it will select all console blocks. it will then display the value of first_pos and ask for input Value of POS <15>: 5 If you enter anything it will then change first_pos to the new value.
    2 points
  2. Here is an assortment of lisp for dynamic block I came across awhile ago. https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-manipulate-a-dynamic-block-with-lisp/m-p/1605323/highlight/true#M208093 Shows what variables there are in your block Reads a given variable in your block Changes a given variable in your block Returns a selection set of blocks with the same effective name Find dynamic blocks with the same effective name Type the following and it will display the attribute. (getdynprop (entsel) "first_pos") ;;---------------------------------------------------------------------- ;; Reads a given variable in your block (defun getdynprop (e propname / obj v vval sal tot i curval) (setq obj (if (= (type e) 'vla-object) e (vlax-ename->vla-object e))) (if (= (vlax-get-property obj 'isdynamicblock) :vlax-true) (progn (setq v (vla-getdynamicblockproperties obj) vval (vlax-variant-value v) sal (vlax-safearray->list vval) tot (length sal) i 0 ) (while (< i tot) (if (= (vlax-get-property (nth i sal) "PropertyName") propname) (progn (setq curval (vlax-get-property (nth i sal) "Value")) (setq i tot) ) (setq i (1+ i)) ) ) ) ) (if curval (vlax-variant-value curval)) )
    1 point
  3. They are dynamic blocks in your sample so this matches your sample, it can be changed to work with any dynamic blocks. Try it https://www.cadtutor.net/forum/topic/73872-fill-csv-file-with-block-attributes/ ;; Get Dynamic Block Property Value - Lee Mac ;; Returns the value of a Dynamic Block property (if present) ;; blk - [vla] VLA Dynamic Block Reference object ;; prp - [str] Dynamic Block property name (case-insensitive) (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) ) ) (defun LM:getdynprops ( blk ) (mapcar '(lambda ( x ) (cons (vla-get-propertyname x) (vlax-get x 'value))) (vlax-invoke blk 'getdynamicblockproperties) ) ) (defun c:exdynblk ( / ss blk x lst fo str) (setq ss (ssget (list (cons 0 "INSERT")))) (if (= ss nil) (progn (alert "You have not picked blocks ")(exit)) (progn (setq fo (open "d:\\acadtemp\\dynblks.csv" "W")) (setq num 0) (repeat (setq x (sslength ss)) (setq blk (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (setq lst (LM:getdynprops blk )) (setq str (strcat (rtos (setq num (1+ num)) 2 0) "," (rtos(cdr (nth 0 lst)) 2 2) "," (rtos (cdr (nth 2 lst)) 2 2) "," (rtos (cdr (nth 4 lst)) 2 2) ) ) (princ str) (write-line str fo) ) (close fo) ) ) (princ) ) (c:exdynblk)
    1 point
  4. Hi Please Attached Drawing example And Excel file
    1 point
  5. You want something like this "multi radio button2.lsp" and I use lee-mac dynamic block lisp. You can have up to about 20 values per column dont have to have same amount per column.Multi radio buttons 2col.lsp if (not ah:buttscol)(load "Multi Radio buttons 2col.lsp")) (if (= ah:but nil)(setq ah:but 1)) (if (= ah:but2 nil)(setq ah:but2 1)) (setq lst1 (list "Select rad 1" "5" "7.5" "10" "12.5" "15" "other r1")) (setq lst2 (list "Select rad 2" "20" "25" "30" "35" "40" "other r2")) (ah:buttscol ah:but ah:but2 "Dual Circles" lst1 lst2) (setq ans1 (nth ah:2col ah:butlst)) (setq ans2 (nth ah:2col2 ah:butlst2))
    1 point
  6. BricsCAD cant make dynamic blocks. so for the most part I only use standard blocks. To make it clean probably want a DCL that uses a drop down liste & pulling information with these. https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-manipulate-a-dynamic-block-with-lisp/m-p/1605323/highlight/true#M208093
    1 point
×
×
  • Create New...