Tuesday, November 28, 2023
Home3D ModelingI've questions on push/pull by group - Ruby API

I’ve questions on push/pull by group – Ruby API


Hello I ask questions in regards to the push/pull perform by group.

I used to be learning the API by referring to the API created by the person ‘dezmo’, however one thing shouldn’t be going my method.

def pushpull_faces_in_selected_groups
  prompts = ['Push/Pull Distance']
  defaults = [0.to_l]
  outcomes = UI.inputbox prompts, defaults, 'Distance to Push/Pull'
  distance = outcomes[0]
  mannequin = Sketchup.active_model
  targets = mannequin.choice.grep(Sketchup::Group)
  targets.everygoal
finish
pushpull_faces_in_selected_groups

Within the case of the API referred to above, push/pull proceeds within the course, however the chosen face is reversed to substantiate {that a} group is created.
Within the software at present beneath growth (three.js), it’s categorized based on course, so the traditional worth of the corresponding face can be essential, so the face shouldn’t be reversed.

Second, the present peak worth (comparable to distance) is given a -value (as a result of the traditional worth of the default face is -Zaxis)
I ask if there may be any strategy to go up solely with Zaxis.

I all the time really feel grateful for fixing the issue with pleasant explanations from customers.
I’d admire any assist once more. :pray:

earlier than pushpull test face.regular
in case it’s unfavourable change de distance worth

Word that with the discharge of 2021.1, faces at the moment are created on the XY “floor” airplane with “butter-side” up.

So, though you’re nonetheless on v2015, your extension might want to take into consideration these newer variations conduct.

norm_vec = face.regular
if norm_vec.parrallel?(Z_AXIS)
  face.reverse! until norm_vec.samedirection?(Z_AXIS)
finish

REF:

I’m making an attempt, however it doesn’t work out in addition to the recommendation. :joy: :joy: :joy: thanks for the recommendation

Thanks for serving to me once more however I didn’t perceive how one can apply
I boldly utilized it to the extension, however the error happens
‘Error: #<NoMethodError: undefined technique `regular’ for #Array:0x0000021ccff5c858>’

Ought to I defin ‘regular’ prematurely?

You must apply regular to a face. You’re making use of to an array

You can attempt utilizing the remodel software to vary the face with out turning it round. This could allow you to maintain the face in its authentic place and push or pull it to the peak you need.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments