Compare Scale and get its value

Compare Scale and get its value

avinash00002002
Collaborator Collaborator
223 Views
1 Reply
Message 1 of 2

Compare Scale and get its value

avinash00002002
Collaborator
Collaborator

Hi!

I have some circles which have with different scales. and Its diameter are 13.5, 17.5 21.5, 25.5 27.5 etc...

 

(setq opp3 (cdr (assoc 40 opp))) ;Radius of circle
 
I want to get the scale of cirlce based on (opp3) diameter.
 
like this ((= opp3 17.5) (progn (setq blk1 "H2") (setq ScL 2.0)))
But Scale is may vary from 0.2 to 20 scale.
 
Thanks,
 
Avinash
 
 
 
0 Likes
224 Views
1 Reply
Reply (1)
Message 2 of 2

Kent1Cooper
Consultant
Consultant

Probably the best way is to make an association list of the radii in sub-lists with the appropriate Block names and Scales.

 

(setq THELIST '((13.5 "Bob" 25.9) (17.5 "H2" 2.0) (21.5 "Carol" 0.25) (25.5 "Ted" 500) (27.5 "Alice" 0.0032)))

 

Then once you have pulled the radius from a Circle's entity data into your opp3 variable:

 

(setq

  blk1 (cadr (assoc opp3 THELIST))

  ScL (caddr (assoc opp3 THELIST))

)

 

That will extract the Block name and Scale from the appropriate sub-list, without the need to check via (= opp3 17.5) through the various radii.

 

If there might be Circles whose radii do not occur in the list, then check for that:

 

(if (assoc opp3 THELIST)

  (setq ; then

    blk1 (cadr (assoc opp3 THELIST))

    ScL (caddr (assoc opp3 THELIST))

  )

  (prompt "\nThat Circle is not of a standard radius."); else

)

Kent Cooper, AIA
0 Likes