Get Dist type, minimum, maximum and increment values of a distance parameter in Autolisp?

Get Dist type, minimum, maximum and increment values of a distance parameter in Autolisp?

ShricharanaB
Advocate Advocate
1,089 Views
8 Replies
Message 1 of 9

Get Dist type, minimum, maximum and increment values of a distance parameter in Autolisp?

ShricharanaB
Advocate
Advocate

Hi, 

 

I'm trying to create a block adder that will get two points and set the nearest allowed length for a block (needed to calculate the start point to add next block as well). I need to get the possible values from the block itself which has the distance type as Increment. How do I get the min, max and increment values from the linear parameter? 

 

Thanks in advance for any help.

 

Edit:  added images, these are the values I want to get from the bock. 

 

ShricharanaB_0-1671864295514.png

ShricharanaB_1-1671864323466.png

 

0 Likes
Accepted solutions (1)
1,090 Views
8 Replies
Replies (8)
Message 2 of 9

Sea-Haven
Mentor
Mentor

Post at least a image of what you want a dwg is better.

0 Likes
Message 3 of 9

ShricharanaB
Advocate
Advocate

Hi,

Added image.

 

I've figured out how to do everything else and its all working with a hardcoded list of lengths like below
(2600 5100 7600 10100 ... )
Since the block can be updated in the future with different length requirements I need to get it every time from the block itself before I go ahead with calculations.

0 Likes
Message 4 of 9

ВeekeeCZ
Consultant
Consultant
Accepted solution

You can start with Lee's getvisparam routine to see how to tread the dictionaries... Then search for your linear param instead of for the visibility. Use code 305 to confirm the param name and then get code 141, 142 and 143 to get min, max and step, respectively.

Good luck.

 

BeekeeCZ_0-1671882282038.png

 

Message 5 of 9

ShricharanaB
Advocate
Advocate

Hi, 

 

Thank you, that works!. I'm able to get the parameter values now. By replacing vl-some with mapcar and then removing nil values with vl-remove from the list, I'm also able to get the entire list of linear parameters in the block. 

0 Likes
Message 6 of 9

prountzos509
Contributor
Contributor

are we able to modify those values though ?

0 Likes
Message 7 of 9

ВeekeeCZ
Consultant
Consultant

(setpropertyvalue (car (entsel "Select dynblock: ")) "AcDbDynBlockPropertyDistance1" (getdist "New dist: "))

0 Likes
Message 8 of 9

prountzos509
Contributor
Contributor

i dont mean the property value i mean the properties of the linear parameter dist type (increment) dist increment dist min dist max

dxfcodes 96, 141, 142, 143. i have this :

((-1 . <Entity name: 30f5358c0b0>) (0 . "BLOCKLINEARPARAMETER") (5 . "661D63") (102 . "{ACAD_XDICTIONARY") (360 . <Entity name: 30f5358c750>) (102 . "}") (330 . <Entity name: 30f5358c0a0>) (100 . "AcDbEvalExpr") (90 . 48) (98 . 33) (99 . 329) (100 . "AcDbBlockElement") (300 . "Linear") (98 . 33) (99 . 329) (1071 . 32) (100 . "AcDbBlockParameter") (280 . 1) (281 . 0) (100 . "AcDbBlock2PtParameter") (1010 0.0 0.0 0.0) (1011 0.240209 0.549818 0.0) (170 . 4) (91 . 52) (91 . 49) (91 . 0) (91 . 0) (171 . 1) (92 . 52) (301 . "DisplacementX") (172 . 1) (93 . 52) (302 . "DisplacementY") (173 . 1) (94 . 49) (303 . "DisplacementX") (174 . 1) (95 . 49) (304 . "DisplacementY") (177 . 0) (100 . "AcDbBlockLinearParameter") (305 . "Distance1") (306 . "") (140 . 0.076861) (307 . "") (96 . 8) (141 . 0.6) (142 . 1.0) (143 . 0.1) (175 . 0))

but when i entmod dxf 96 with

(entmod (subst (cons 96 7) (assoc 96 (entget(car lst))) (entget(car lst))))

i get ; error: bad DXF group: (1071 . 32)

 

0 Likes
Message 9 of 9

prountzos509
Contributor
Contributor

PS

updated Lee's function as pointed from you BeekeeCZ with some additions i like

(defun LM:getDnmcprmtrlst ( blk par / lst)
         (if (and (vlax-property-available-p (setq blk (if (= 'ENAME (type blk)) (vlax-ename->vla-object blk) blk)) 'effectivename)
                       (setq blk (vla-item(vla-get-blocks (vla-get-document blk))(vla-get-effectivename blk)))
                       (= :vlax-true (vla-get-isdynamicblock blk))
                       (= :vlax-true (vla-get-hasextensiondictionary blk))
             )
             (setq lst (vl-remove-if ''((x)(eq x nil))(mapcar ''((pair)(if (and (= 360 (car pair))
                                                                                                                          (= par (cdr(assoc 0 (entget(cdr pair)))))
                                                                                                                )
                                                                                                                (cdr pair)
                                                                                                           )
                                                                                                 )
                                                                                                 (dictsearch(vlax-vla-object->ename(vla-getextensiondictionary blk))"ACAD_ENHANCEDBLOCK")
                                                                             )
                           )
            )

            (princ (strcat "\nThis Block doesnt contain " par))
       )
       (if lst lst)

       (princ)
)

(LM:getDnmcprmtrlst  (car(entsel)) "BLOCKLINEARPARAMETER")

0 Likes