I’m trying to figure out how we can get the landing Face that the user places the new component on.
For my example (please see the pic), the user will use Move/Placing control to place the component at the midpoint of the square desk’s face. I can use onPlaceComponent to trigger and get the Component Instance. However, I don’t know how to get the landing Face.
Also, your demo is quite similar as the thing I’m trying to do, I want to make the new component can be rotated automatically based on the landing face. If you could share a bit how you did it, that’d be great!
You can use either Sketchup::InputPoint or Sketchup::PickHelper. The former uses inferencing (snapping) the latter doesn’t (but allow for more control over what entity to pick).
(You can also use model.raytest, but InputPoint and PickHelper will give you more information and be more consistent with SU’s own tools in most cases.
@tt_su Yes, with the new tool. How to use Sketchup::InputPoint or Sketchup::PickHelper with native ComponentTool, after user place component from Components Dialog?
Thanks @tt_su and @voquochai, yes, I’m trying to get the landing face in onPlaceComponent of ModelObserver. I’m wondering if we can create new tool inherited some behaviors of Placement tool or not? or if you know there is any possible way do get the landing face. Please let me know. Thanks.