Friday, December 1, 2023
Home3D ModelingDecide if element has kids? - Ruby API

Decide if element has kids? – Ruby API


I’ve learn/searched right here for a bit and may’t appear to discover a approach to inform if a element is nested. Hope I’m mistaken any ideas?

Thanks

Entity technique “guardian”



1 Like

Thanks!


mannequin = Sketchup.active_model
selset = mannequin.choice

selset.every do|dc|
  dc_parent = dc.guardian
  if dc_parent == mannequin
    places 'guardian'
  else
    places 'baby'
  finish
finish

This works if the guardian is on the high mannequin degree. I understand now that I want it the opposite method :man_facepalming:, can I inform if it has kids?

Then you need to iterate alongside the element definition entities. If one in every of them has definition then your element has kids.
By the best way choice is an array, it’s not neccesary .to_a



1 Like

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments