Jump to content

How to create Dynamic Block that scales according to user's input?


Recommended Posts

Posted

Hi all, 

 

I'm having an issue trying to create a Dynamic Block that scales in size according to the user's input value. 

 

For example, I have 2 circles, 'Inside' and 'Outside'. I hope to allow the user to change the scale of the 'Inside circle' and 'Outside Circle' independently by typing in a value. Then the values would be display in a label. Please see attached diagram of what I've just described. Is it possible to have  a  few preset options for the 'Inside Circle' and 'Outside Circle' so that the user can choose from? And also allow them to enter in custom size. How would I go creating such dynamic block? The diagram is just a quick drawing and doesn't work. 

 

Thank you and have a good day.

 

 

example3.PNG

example4.PNG

Posted

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

 

image.png.6452d7f6a2f5c37e222fda4b8623d910.png

 

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))

 

 

  • Thanks 1
Posted

Hi everyone, thanks for all the replies. I apologies for the late reply. Work has been pretty hectic for the past week and I haven't gotten a chance to thank you guys until now. 

 

@mhupp Thanks for the info, I will check that out and play around with it. Much appreciated it!

 

@BIGAL Thanks again Bigal for always helping me out. I really am grateful for the help. I'll test out the codes and see if I can get it to work for my issue. 

Posted

@BIGAL Hi Bigal, I tried out the lisp script you provided but I got an error message saying '; error: too few arguments'. I've been trying to resolve the issue by changing all the "ah" is the defun to "C:" and the script still wouldn't run. Any idea what is causing the issue? thanks for sharing the script. Much appreciated :)

 

I'm hoping to create a dynamic block so I could use it for the tree, the trunk diameter and the canopy diameter. Hence, I want a list of standard trunk and canopy size for the user to quickly choose from or enter in custom size. Do you think a nested dynamic block would work in this case? 

Posted (edited)

Just make a dynamic block with rad1 rad2 for the circles say both 1 unit dia. 

 

The code above  is missing a ( at start sorry. Fixed it and this is closer to what you want. In CIV3d can do TR6*3 which means a 6m tree with a 300mm trunk so i did what you want and would update a tree block.

 

(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 spread 1" "2" "5" "10" "12.5" "15" "other r1"))
(setq lst2 (list "Select trunk" "0.3" ".45" "0.6" "0.9" "1.2" "other r2"))
(ah:buttscol ah:but ah:but2 "Dual Circles" lst1 lst2)
(setq ans1 (atof (nth ah:2col ah:butlst)))
(setq ans2 (atof (nth ah:2col2 ah:butlst2)))

 

You are lucky here is treedyn.dwg, How do you intend to match to a point ?

 

Edited by BIGAL
Posted

@BIGAL Thankyou so much Bigal, that works great! I'm going to play around with it and see if I could add a dynamic field text label that displays the trunk and canopy diameters. Will let you know how that goes.

 

Thanks again everyone. Y'all the best! :) 

Posted

For anyone else bedit the treedyn block and look at dynamic properties.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...