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)
targets.every
goal.make_unique
tents = goal.entities
faces = tents.grep(Sketchup::Face)
faces.everye
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 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.
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)
finish
REF:
I’m attempting, nevertheless it doesn’t work out in addition to the recommendation. 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