Notifications
Clear all

[Closed] windows and doors data collection with dropdownlist

I am trying to make a rollout that would allow me to output certain properties of windows or doors based on selection via dropdownlist with no success. See the script below where the dropdownlist and conditional statements if b == “windows” then and if b == “doors” then have been made a comment since I am not being able to make them work 🙁 . I am also attaching a scene that I am using for testing the script.
I appreciate any comments. Thanks in advance.

–doors and windows data extraction with UI
rollout dwdeaRoll “Doors & Windows Data Extraction Assistant” width:200 height:100
(
–dropdownlist b “collect data from:” items:#(“windows”,“doors”)
button c “collect data”
–if b == “windows” then
on c pressed do
(
for o in geometry where hasproperty o “Horizontal_Frame_Width” do format “% % Width %
” (classof o) o.name o.Width
for o in geometry where hasproperty o “Horizontal_Frame_Width” do format “% % Height %
” (classof o) o.name o.Height
for o in geometry where hasproperty o “Horizontal_Frame_Width” do format “% % Depth %
” (classof o) o.name o.Depth
for o in geometry where hasproperty o “Horizontal_Frame_Width” do format “% % Frame_Thickness %
” (classof o) o.name o.Frame_Thickness
for o in geometry where hasproperty o “Horizontal_Frame_Width” do format “% % Glazing_Thickness %
” (classof o) o.name o.Glazing_Thickness
for o in geometry where hasproperty o “Horizontal_Frame_Width” do format “% % Horizontal_Frame_Width %
” (classof o) o.name o.Horizontal_Frame_Width

--if (b == "doors") then
	for o in geometry where hasproperty o "Leaf_Thickness" do format "% % Width %

” (classof o) o.name o.Width
for o in geometry where hasproperty o “Leaf_Thickness” do format “% % Height %
” (classof o) o.name o.Height
for o in geometry where hasproperty o “Leaf_Thickness” do format “% % Depth %
” (classof o) o.name o.Depth
for o in geometry where hasproperty o “Leaf_Thickness” do format “% % Frame_Width %
” (classof o) o.name o.Frame_Width
for o in geometry where hasproperty o “Leaf_Thickness” do format “% % Frame_Depth %
” (classof o) o.name o.Frame_Depth
)
)
createDialog dwdeaRoll

4 Replies

Please use the [ code ] and [ /code ] tags and indentation, that will make your code a lot easier to read.

You can use the dropdownlist’s selected property.

if b.selected == "windows" then (

http://docs.autodesk.com/3DSMAX/14/ENU/MAXScript%20Help%202012/files/GUID-172DE6D6-796F-419B-936E-4FD64AD24CB-1783.htm

Thank you very much. I guess the next problem in the script is to combine properly the for loop with the conditional statement and the button event handler. I am having a hard time understanding which one goes first in the script and the proper syntax 🙁
I will keep trying and reading the reference material but if anybody has any hint I appreciate any comments.

sorry for not using the proper script format, I have been copying and pasting in notepad, I should probably use another work flow.

on c pressed do (
  if b == "windows" then (
    for o in geometry where hasProperty o "Horizontal_Frame_Width" do (
       format "% % Width %
" (classof o) o.name o.Width
       [...]
    )
  )
  else if b == "doors" then (
    [...]
  )
 )

It might be better to use isKindOf or some other way of checking the object’s class instead of “hasProperty”.

yes! Thank you.
I got it somehow to work (see attachment) just before reading your post. I am not using else and it seems to work. The big problem I had was with parenthesis…

…And also the part where I am using specific properties of doors and windows (Horizontal_Frame_Width and Leaf_Thickness) to point to the right objects is probably not a great solution as I wish I could just call the category of objects windows and doors but I am not sure if possible and how to accomplish.

Thanks again Pjanssen for your valuable advice.