thx
But I receive an error if the faces normal is parallel to Z_AXIS.
I have added the following lines and it seems to work, but is it the correct solution?
if !vector.parallel?(Z_AXIS) then
up = Z_AXIS
else
up = Y_AXIS
end
thx
But I receive an error if the faces normal is parallel to Z_AXIS.
I have added the following lines and it seems to work, but is it the correct solution?
if !vector.parallel?(Z_AXIS) then
up = Z_AXIS
else
up = Y_AXIS
end
Hello!
Is it possible to call the "Align View"-method of the context-menu from a ruby script? Or what kind of script do I need to get such a functionality?
@dan rathbun said:
I think you need to use MF_CHECKED for the active item, and MF_UNCHECKED (or MF_ENABLED ) for the other two.
I tried it, but it did not work. Is there a way to get a radiobutton-like behaviour of toolbar-buttons?
I try to explain how I want to use my buttons:
My first button (standard) represents the default view, every face looks normal.
When the second button (building) is clicked, the color of every face is set back to the default color. The user can now use the paint-bucket to select the parts of the building he want to export later. After clicking on one of the other buttons the parts representing the building are stored and the original colors are restored.
When the third button (zone) is clicked, the color of every face is set back to the default color. Now the user can use different colors with the paint-bucket to group the parts of the building. After clicking on one of the other buttons the grouping is stored and the colors are restored.
So there is no need to implement every button as a tool. The annoying thing is that everything works fine with the windows-version. Is there a way to get such a behaviour as explained above for the mac-version?
@thomthom said:
And this is done automatically by SU without use for validation procs...
Ok, so I better forget my validaction proc tries.
Another question related to this topic:
Is there a way to keep one of my tools active when I select e.g. the paint bucket tool?
I try to describe my problem:
I have 3 buttons and each one represents a tool. Now I want the same behaviour as the standard-sketchup toolbar, so that only one tool can be activated at one time. (the button of the selected tool should be pressed)
My solution works only on windows, where I use the flags mf_checked and mf_unchecked in the .set_validation_proc method.
Hello!
I've discovered a different behaviour of my toolbar buttons on windows and on mac.
When I press my toolbar-button on windows, the button 'jumps' back and on mac the button keeps pressed.
I have tried to use the .set_validation_proc method to get the same behaviour on both systems, but my solutions don't work. How do I have to manipulate the .set_validation_proc method the get the same toolbar-button-behaviour on mac as on windows-systems?
hey
I have a strange problem with my toolbar on mac-systems. I use command-objects for providing menu and toolbar-entries.
In my plugin I have 3 "views" and they behave "radiobutton-like", so only one can be pressed.
I use the .set_validation_proc method where I set the current "view" to MF_GRAYED and the other two to MF_ENABLED.
Everything works as expected on windows-systems (menu and toolbar behaviour), but not on mac-systems.
On mac the menu works fine, but the toolbar-buttons keep grayed instead of beeing enabled when I press on one of the other buttons. So after pressing on each button, they are all grayed. (only the toolbar)
I have 3 internal modes: "standard", "building", "zones"
cmdStandard.set_validation_proc {
model = Sketchup.active_model
mat_dict = model.attribute_dictionary("my_dictionary", true)
if mat_dict["mode"] == nil || mat_dict["mode"] =="standard" then
MF_GRAYED
else
MF_ENABLED
end
}
cmdStandard is my default-view-command. "standard"-mode is default and so the button and menu-entry is grayed.
cmdBuilding.set_validation_proc {
model = Sketchup.active_model
mat_dict = model.attribute_dictionary("my_dictionary", true)
if mat_dict["mode"] == nil || mat_dict["mode"] == "standard" then
MF_ENABLED
else
if mat_dict["mode"] == "building" then
MF_GRAYED
else
MF_ENABLED
end
end
}
cmdBuilding is the command for one of the other two views. They should be enabled if the plugin is in "standard"-mode. The zone-command is the same as cmdBuilding but checks for "zone" instead of "building".
I don't know what I should do to get the same behaviour as on windows-systems?
thanks for your advice, I will try your suggested methods.
Hello!
I've problems with the transfer of Unicode-characters from a WebDialog back to ruby.
The WebDialog-charset is utf-8.
For example, I write the text "tető" into a inputbox and I'd like to transfer it to ruby.
I write:
window.location="skp;export_command@" + text;
Ok that works. In Sketchup I get the text with
wd.add_action_callback("export_command") do |wd, args| ...
Now, my problem is that the text in 'args' is different than the originally one.
Instead of
"tető".unpack('U*')
[116, 101, 116, 337]
I get: [116, 101, 116, 111]
Is there a way to handle this correctly? My very dirty solution is to write the utf-8 value for each character via javascript into a string, e.g. "[116, 101, 116, 337]" and then send this sequence back to ruby. After that I build an array and make
array.pack('U*')
to get the correct text.
@thomthom said:
Iterate over the face's edges and check if any of them are smooth/soft/hidden and have another face attached.
thx