DC child component

DC child component

Postby Jorgensen » Fri Sep 30, 2016 9:50 am

hi

i have just started experimenting with dc, and i have a quick question.

i have a group - "char", that contains two groups "seat", "legs".

i have added a onClick behavior that i would like to hide / show the legs (just for testing).

i thought i could do something like legs.SET("hidden", 0, 1), but that gives an error.

i can ad the onclick behavior direct at the "legs", but when they are hidden, i can't click to show them again - so i thought the solution could be to add the behavior to the parent.

is it possible to access childs from the main group?

thanks
jorgensen
0
sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

Jorgensen 
 

Re: DC child component

Postby pcmoor » Fri Sep 30, 2016 11:42 am

create an attribute say called hide in the parent and give it a value 0, toggle this via the onClick with SET("hide", 0, 1).

Then for hidden attribute value within the children(legs)
hidden = parent!hide (or char!hide)
0

pcmoor 
 

Re: DC child component

Postby pcmoor » Fri Sep 30, 2016 11:50 am

can use SET("legs!Hidden", 0, 1) as direct reference as well
0

pcmoor 
 

Re: DC child component

Postby Jorgensen » Fri Sep 30, 2016 12:28 pm

hi pcmoor

thank you very much for your fast reply.

i have opened your file and it works just fine!

i have tried to replicate the same behavior to my own model, but i can't get it to work - though it seems that i have done exactly the same.

could i ask you to test the file? it might just be a typeping error
0
sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

Jorgensen 
 

Re: DC child component

Postby pcmoor » Fri Sep 30, 2016 12:54 pm

hav't an explanation to why example 2 does not work, however able to fix using example 1

will look into it tomorrow
0

pcmoor 
 

Re: DC child component

Postby pcmoor » Sat Oct 01, 2016 1:47 am

the difference between my examples (hide.skp) and your model (save.skp) is the parent is a component in mine whereas yours is a group. It appears groups can't pass down a value, but rather they need to reference the parent.
0

pcmoor 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Dynamic Components

Who is online

Users browsing this forum: No registered users and 1 guest

Visit our sponsors: