Hello dear Fredo. Can I ask you to make a small edit to your plugin? Could we have more than 2 (3,4,5...N) scale planes in the plugin?
Posts made by kostiaarh
-
RE: [Plugin][$] FredoScale - v3.6a - 01 Apr 24
-
RE: [Plugin] 2D Tools
I would like to ask for help with a small change to the 2D Fillet code.
I do a little woodworking (cabinet) and would like some tools to make my job easier. I tried to change the code myself, but my knowledge in programming is very insufficient). So I am asking you to help me. Also, let me say up front that I know of other chamfering and rounding tools, but they don't work for me for various reasons. They do not create a solid arc or curve, and the chamfer function has no methods to set different chamfer distances.
Now about the code. I would like to have a simple 3D Fillet/Chemfer. The tool should work with objects (group or component) regardless of nesting level. I added the code to the onMouseMove method and now it works.def onMouseMove(flags, x, y, view) ### ph = view.pick_helper ph.do_pick(x,y) @poss_edge = ph.picked_edge ### center_ip = Sketchup;;InputPoint.new center_ip.pick(view, x, y) view.model.active_path = center_ip.instance_path.valid? ? center_ip.instance_path ; nil if @state==0 if @alt ### chamfer ..................
But here there is a problem) How to remove residual geometry? Look at the picture. Am I understanding this correctly? I need to find the residual face and push it to the parallel face. right? Or maybe there are other ways to do it differently?
-
Fix and improve the code
Please help me to fix and improve the code.
I have a problem with calculating the dimensions of scaled objects and objects rotated relative to global axes.
First, the code was written, which uses the method of calculating the dimensions of the object by the points of the edges (thanks for the tip from the official Sketchup forum). And this method works well with objects rotated relative to global axes.
Here is the code.
This code calculates dimensions correctly in rotated relative to global axes, but incorrectly in scaled objects.class TestTool def initialize @ip = Sketchup;;InputPoint.new @hovered_inst = nil end def onMouseMove(flags, x, y, view) @ip.pick(view, x, y) @ph = view.pick_helper @in_path = @ip.face ? @ip.face.parent.instances ; nil @hovered_inst = @in_path&.first if @in_path view.invalidate end def draw(view) @ip.draw(view) if @ip.valid? view.draw_points(@ip.position, 40, 5, "red") if @ip.valid? view.tooltip = @hovered_inst&.name if @hovered_inst.is_a?(Sketchup;;Group) || @hovered_inst.is_a?(Sketchup;;ComponentInstance) entity = @hovered_inst edges = entity.definition.entities.select { |e| e.is_a?(Sketchup;;Edge) } points = edges.flat_map { |e| [e.start.position, e.end.position] } min_x, max_x = points.minmax_by { |p| p.x }.map(&;x) min_y, max_y = points.minmax_by { |p| p.y }.map(&;y) min_z, max_z = points.minmax_by { |p| p.z }.map(&;z) length = (max_x - min_x) * 25.4 width = (max_y - min_y) * 25.4 thickness = (max_z - min_z) * 25.4 dimensions = [length, width, thickness].sort length = dimensions.last width = dimensions[1] thickness = dimensions.first area = (length * width / 1000000).round(2) text = "Ім'я; #{entity.name}\nДовжина; #{length.round(1)} мм\nШирина; #{width.round(1)} мм\nТовщина; #{thickness.round(1)} мм\nПлоща; #{area} м.кв." draw_text_with_bigger_font(view, [20, 20], text, 16) end end def draw_text_with_bigger_font(view, position, text, font_size) options = { color; "red", font; "Arial", size; font_size, bold; true, align; TextAlignLeft } view.draw_text(position, text, options) end end Sketchup.active_model.select_tool(TestTool.new)
But then I ran into a bug and found that it was calculating the dimensions of the scaled object incorrectly. I tried to fix it in the code.
Here is the code.This code correctly defines dimensions in scaled groups, but incorrectly in rotated relative to global axes.
### In the updated code, a new transform_point method was added, which applies the transformation matrix of the object to the specified points. ### This method is used to transform the vertex coordinates of the edges before dimensioning. class TestTool def initialize @ip = Sketchup;;InputPoint.new @hovered_inst = nil end def onMouseMove(flags, x, y, view) @ip.pick(view, x, y) @ph = view.pick_helper @in_path = @ip.face ? @ip.face.parent.instances ; nil @hovered_inst = @in_path&.first if @in_path view.invalidate end def draw(view) @ip.draw(view) if @ip.valid? view.draw_points(@ip.position, 40, 5, "red") if @ip.valid? view.tooltip = @hovered_inst&.name if @hovered_inst.is_a?(Sketchup;;Group) || @hovered_inst.is_a?(Sketchup;;ComponentInstance) entity = @hovered_inst edges = entity.definition.entities.select { |e| e.is_a?(Sketchup;;Edge) } transformed_points = edges.flat_map { |e| transform_point(entity.transformation, e.start.position, e.end.position) } min_x, max_x = transformed_points.minmax_by { |p| p.x }.map(&;x) min_y, max_y = transformed_points.minmax_by { |p| p.y }.map(&;y) min_z, max_z = transformed_points.minmax_by { |p| p.z }.map(&;z) length = (max_x - min_x) * 25.4 width = (max_y - min_y) * 25.4 thickness = (max_z - min_z) * 25.4 dimensions = [length, width, thickness].sort length = dimensions.last width = dimensions[1] thickness = dimensions.first area = (length * width / 1000000).round(2) text = "Ім'я; #{entity.name}\nДовжина; #{length.round(1)} мм\nШирина; #{width.round(1)} мм\nТовщина; #{thickness.round(1)} мм\nПлоща; #{area} м.кв." draw_text_with_bigger_font(view, [20, 20], text, 16) end end def transform_point(transformation, *points) points.map { |pt| transformation * pt } end def draw_text_with_bigger_font(view, position, text, font_size) options = { color; "red", font; "Arial", size; font_size, bold; true, align; TextAlignLeft } view.draw_text(position, text, options) end end Sketchup.active_model.select_tool(TestTool.new)
I try to combine these two methods, but nothing works). What am I doing wrong?
I will be very grateful for tips. -
RE: [Plugin][$] RoundCorner - v3.4a - 31 Mar 24
@dave r said:
Do you mean having the series of straight edges welded together so they are recognized by Sketch as arcs or curves? If so, that could be very useful. Currently I make that happen by runing Eneroth Auto Weld after using Round Corner or Fredo Corner.
Exactly
-
RE: [Plugin][$] RoundCorner - v3.4a - 31 Mar 24
@dave r said:
@kostiaarh said:
I see that roundcorner and fredocorner build arcs with just segments, not "arc". Why is this so?
This isn't a Round Corner thing. It's the way SketchUp represents arcs and curves. You've been using SketchUp long enough that you would know this.
Yes, I know about it.) Perhaps it is the difficulty of translation). The question was more about whether we could have a plugin from Fredo in the future that would create a "arc/curve" instead of individual segments.
-
RE: [Plugin][$] RoundCorner - v3.4a - 31 Mar 24
First, thank you for such great plugins. Question: Can we build real arcs instead of simulating them with segments? I see that roundcorner and fredocorner build arcs with just segments, not "arc". Why is this so?
-
RE: Radial menu inside SU
@rich o brien said:
@kostiaarh said:
@Rich O Brien plugin Pie for SketchUp does not work Sketchup 2023
Yeah, I'm aware of it.
We will wait for updates?
-
RE: Radial menu inside SU
@Rich O Brien plugin Pie for SketchUp does not work Sketchup 2023
-
RE: Plugin Search
@dave r said:
Sam D Mitch has withdrawn his extensions and it wouldn't be right to share them. You might look at S4U Align from the SCF Plugin Store or Curic Align from the Extension Warehouse.
Thanks Dave R. Yes, others have suggested a solution to me too using Curic plugins. Curic Reset Rotation + Curic Space + Curic Align
-
RE: Plugin Search
Maybe someone has Sam D Mitch's "Comp String" plugin? I am just looking for a similar solution. https://forums.sketchup.com/t/arrange-components/169188
-
RE: New to DC: topic for my simple questions to the pros
@pibuz said:
I have a new question for the community: I have an attribute which ALWAYS include alternatively the words "OPACO" "LUCIDO" or "SEMILUCIDO" (name of the material applied). The words are always at the end of the text string, but the number of digits before may change.
I want another attribute to report ONLY the occuring word from case to case.
EG: my material attribute returns "grey RAL7040 OPACO", I want another attribute to report only "OPACO".
Is there a way to do this?
try so: =RIGHT(Material, 5)
-
RE: [Plugin] Universal Importer - v1.2.6 - 30 July 2024
@samuel_t said:
Hello @kostiaarh. This sounds like a bug. Could you please upload your model to a file hoster? This way I could debug it.
Yes. I uploaded the file. Thanks you.
https://mega.nz/#!WKZDkYSA!3HFXWqZTRpVGt_tUftP-i639I5TpToyvc4lG9apMFTA -
RE: [Plugin] Universal Importer - v1.2.6 - 30 July 2024
Hello. Importer Error. What does that mean
-
RE: Find and replace multiple components?
@tig said:
IF you name your components logically then a script in the form
swapcomponents("-aaa","-bbb")
is straightforward - and quite simple - I can talk you through it... Once you have something working vis the Ruby Console it#s easy enough to add a menu item and dialog, even a toolbar and so on...First off - make a logical component-naming strategy/
Then write is a simple step-sheet explaining how you'd like to use the new tool... e.g.I select various cabinets where I want to swap one type of door [and drawer] for another.
I activate the new tool tell it what code to find and what code to replace it with... and it automatically finds equivalent doors [and drawers] in the model [or perhaps SKPs in folder[s]] in ../Components/.
It then uses/loads them and replaces the current component instance with the required definition.
A dialog reports what's been changed and/or any errors.
It is one step undo-able.
For example always name doors 'Door-WWW-HHH-FINISH-CODE' and then all we have to do is swap components with the same base but a new FINISH and/or CODE - In the input you could typeDoor*-Oak-A
and in the output typeDoor*-Maple-A
and all doors code A would change from 'Oak' to 'Maple'; orDoor*-A
>>>Door*-B
would swap from code A to code B - if there were no Oak versions of code B doors then the closing dialog tells you!
On a more global system*-A
>>>*-B
tries to swap all type A 'fitments' to type B.
If things are 'nested' - components inside groups etc then it's more tricky but not impossible...
You could also swap ironmongery fromHandle-*-A
>>>Handle-*-B
.
See the schema ?TIG can I ask you to post an example of this code here? Thanks.
-
RE: [Plugin] ComponentScenes v0.3 UPDATE
Thank you Tig. I put this code in the toolbar editor. Works great.
-
RE: [Plugin] ComponentScenes v0.3 UPDATE
I would also like to know if it is possible to organize the created scenes in the panel? For example, scene1, scene2, scene3 ... sceneN? When I use this plugin, the scenes are placed in a chaotic order.
-
RE: [Plugin] ComponentScenes v0.3 UPDATE
Thanks Tig. I made all the corrections but the plugin does not work. I don’t know what to do with it.
Error: #<NameError: undefined local variable or methoddeleting_group' for main:Object> C:/Users/KOSTIA/AppData/Roaming/SketchUp/SketchUp 2019/SketchUp/Plugins/ComponentScenes.rb:189:in
block in <top (required)>'