Thursday, November 30, 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 concerning 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 will not be going my manner.

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)
    tents = goal.entities
    faces = tents.grep(Sketchup::Face)

Within the case of the API referred to above, push/pull proceeds within the course, however the chosen face is reversed to verify {that a} group is created.
Within the instrument at present below improvement (three.js), it’s categorized in accordance with course, so the traditional worth of the corresponding face can also be vital, so the face shouldn’t be reversed.

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

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

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

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

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

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


I’m attempting, nevertheless 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 the right way to 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?

It’s best to apply regular to a face. You might be making use of to an array



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments