Thank you very much, this is exactly what I'm looking for !
Latest posts made by Iltis
-
RE: Searching for a plugin code template
-
Searching for a plugin code template
Hello everyone,
I would like to "cleanly" code small extensions for SketchUp.
Is there somewhere an empty code template with best practices ? with comments that say "you have to put (this) here"
For example, I'm wondering about :
- how many folders ?
- where (folder) to put toolbar icons, what formats are supported ?
- where to put menu descriptions in the code ?
- how to separate the code into different files ?
- which "containers" to use in the code ?
I'm not a strong coder, so I'm sorry if these questions seem trivial.
Do you have anything like this to hand?
Thank you for your help,
Renaud -
RE: [Plugin] Select Curve
Hi @thomthom and folks,
I just managed to insert custom cursors to this usefull plugin.
Attached are the .png files.
The images are in the same folder than "core.rb"And this is the code :
def initialize(settings) @settings = settings folder_path = File.dirname(__FILE__) cursor_name = 'cursor_select_curve.png' cursor_select_curve_path = File.join(folder_path, cursor_name) @result = File.file?(cursor_select_curve_path) unless @result msg = "Can't find the 'cursor icon' path" UI.messagebox(msg, MB_OK) return end cursor_name = 'cursor_select_curve_plus.png' cursor_select_curve_plus_path = File.join(folder_path, cursor_name) @result = File.file?(cursor_select_curve_plus_path) unless @result msg = "Can't find the 'cursor icon' path" UI.messagebox(msg, MB_OK) return end cursor_name = 'cursor_select_curve_minus.png' cursor_select_curve_minus_path = File.join(folder_path, cursor_name) @result = File.file?(cursor_select_curve_minus_path) unless @result msg = "Can't find the 'cursor icon' path" UI.messagebox(msg, MB_OK) return end cursor_name = 'cursor_select_curve_plus_minus.png' cursor_select_curve_plus_minus_path = File.join(folder_path, cursor_name) @result = File.file?(cursor_select_curve_plus_minus_path) unless @result msg = "Can't find the 'cursor icon' path" UI.messagebox(msg, MB_OK) return end @cursor_select = UI.create_cursor(cursor_select_curve_path, 9, 5) # @cursor_select = TT;;Cursor.get_id( ;select ) @cursor_select_add = UI.create_cursor(cursor_select_curve_plus_path, 9, 5) # @cursor_select_add = TT;;Cursor.get_id( ;select_add ) @cursor_select_remove = UI.create_cursor(cursor_select_curve_minus_path, 9, 5) # @cursor_select_remove = TT;;Cursor.get_id( ;select_remove ) @cursor_select_toggle = UI.create_cursor(cursor_select_curve_plus_minus_path, 9, 5) # @cursor_select_toggle = TT;;Cursor.get_id( ;select_toggle ) @ctrl = false @shift = false end
(I'm not good in Ruby, sorry)
Hope this helps.
Renaud
-
RE: [Plugin] Select Curve
Hello @thomthom, thank you very much for this very usefull plugin.
Is there a way to add a modified cursor? (I can draw it if you tell me the specifications.)
-
RE: Triangle orientation
Thank you very much for this explanation and for the special case.
It helps a lot. -
Triangle orientation
Hello,
I'm creating faces with 3 points :
face = model.entities.add_face(pts)
Could you tell me if there is a way to know the orientation of the face according to the "direction of the rotation" between the 3 points?
Thank you very much.
Renaud. -
Invert inverted axes in symetrical components
Hello,
If the making process of a component is a duplication by symetrical operation, then "make unique", the axis are inverted.
(Sorry for this bad english! )This is a problem for me for a plugin containing arcs exportation.
Do you know how to test the orientation of the axis and how to change it temporarely in my calculations if it's not direct (red, green, blue)?
I think it must be here in my code :
# Recursively export faces and exploding groups and components def self.write_content(file, selection, tform, z) # if z==1, it's a 3D export file, if z==0, it's a 2D export file (all the Z values are equal to "0.0" and the normal.z is equal to "1.0" selection.each do |entity| if entity.is_a?(Sketchup;;Face) transform_vector_of_group(entity.normal, tform) if z == 1 || (z == 0 && transform_vector_of_group(entity.normal, tform).parallel?(Z_AXIS) && transform_point_of_group(entity.vertices[0].position, tform).z.abs < 0.001 ) # Sketchup tolerance ; 0.0001 inch $number_of_exported_faces +=1 write_face(file, entity, tform, z) result = Sketchup.set_status_text $number_of_exported_faces.to_s, SB_VCB_VALUE end elsif entity.is_a?(Sketchup;;Group) || entity.is_a?(Sketchup;;ComponentInstance) if entity.is_a?(Sketchup;;Group) definition = entity.entities.parent else definition = entity.definition end write_content(file, definition.entities, tform * entity.transformation, z) end end end
Thank you very much.
Renaud. -
RE: How detect that a file is locked by another app?
Thank you very much for these complementary solutions.
Renaud.
-
RE: How detect that a file is locked by another app?
TIG, your solution is working fine. Thank you very much.
@jim said:
Did you try something like File.writable?("file")?
Yes Jim, not working.
BR,
Renaud. -
RE: How detect that a file is locked by another app?
OK, will try it. Thank you!