[Plugin] TIG-Smart_offset
-
Hi. I think the plugin has been active for a very long time.
There's a feature I come across often. That applies to text objects.
Is the plugin editable to work like the example below.
I feel.
-
You might be able to add some code to apply the offset to all loops of the face - currently it only works on the outer-loop, so inner 'holes' are not processed...
Feel free to mess around with the code...
-
Well, I know there one was a plugin called TruOffset, which - I think as the only one - respected holes in faces and was also able to offset them. But it's lost in space, and I couldn't find it anywhere these days.
I am referring to this thread:
https://forums.sketchup.com/t/hole-aware-offset/83561
It must have been removed from the Extension Warehouse. I saw it there a few years ago. Maybe it can be found somewhere. -
Hi TIG - I wonder if you'd give me access to the original ruby code - the plugin is not working in my 2020 version of SketchUP and I'd be interested in trouble-shooting the code.
Thanks!
Karen
-
The tool's code is in the main RB file [because it's NOT made as an extension].
Although the file's header says & ...all-rights-reserved... etc I'd be happy for you to troubleshoot it...
What are your problems with it ?
-
Hi TIG,
The file I downloaded is "TIG_Smart_offset_v3.0.rbz"
Forgive me - I've done extensive coding for my own use, but very little with other people's files. My understanding of *.rbz is that is a protected format and there isn't a way to view the original *.rb.
I am getting one error related to Fixnum being deprecated, but the tool is also simply not offsetting for one of my test faces. It's a tricky face, and I haven't been able to write my own offset tool that works for it, which is how I came across your tool. (see below):
-
If you install an RBZ it puts various things into your Plugins folder automatically.
Typically there'll be an RB 'loader' [easily read/edited in a text-editor like Notepad++]
AND a subfolder named after the RB file - containing at least one 'signing' file, and in this case an image file used for a button ?
All of the code for this tool just happens to be in the main RB file...A more complex 'extension' will include other Ruby files in the subfolder, which are loaded by the extension code set up in the first RB [these can be RB [readable] or RBE [encrypted] or defunct RBS [hackable] format].
There might also be files such as HTML, JS, CSS, TXT, Images etc... used by the parts of code...The 'signing' file [SUSIG used currently, or also HASH once used in older SketchUps] is a snapshot of various sensitive files' set ups, as included in the originally submitted RBZ, signed by Trimble.
Changing any of those files affects the SUSIG signing status - but with your Extension Manager's Loading Policy set to 'Unrestricted' the extensions will still load [of course you might have broken something whilst editing !]So to recap - if you install the RBZ you get its contents in your Plugins folder.
BUT an RBZ file is only a ZIP file with another filetype suffix - so you could make a copy of it, rename it with a trailing .ZIP filetype and extract its contents to another folder...
Conversely, adding suitable files and subfolders to a ZIP file and re-filetyping it as an RBZ, works...
Of course it'll be missing any 'SUSIG' signing file added to the RBZ during processing by Trimble... -
Ah, there you go. Thank you!
If I figure out how to make it work for this face, I'll let you know with the updates.
-
Hi TIG - I got something working for my test case. I've inserted the following code at line 834:
### CODE BY KAREN WALKERMAN face.outer_loop.edges.each do |edge| t1 = get_90_trans(face,edge,edge.start.position,dist) t2 = get_90_trans(face,edge,edge.end.position,dist) p1 = edge.start.position.transform(t1) v1 = edge.line[1].reverse v1.length = dist p1.transform! Geom;;Transformation.new(v1) p2 = edge.end.position.transform(t2) v2 = edge.line[1] v2.length = dist p2.transform! Geom;;Transformation.new(v2) line = gents.add_line(p1,p2) end gp.entities.intersect_with(true,gp.transformation,gp.entities,gp.transformation,false,gp) edges = [] gents.each{|e| edges << e if e.is_a? Sketchup;;Edge} edges.each{|e| e.find_faces} togos = [] gents.each do |e| if e.is_a? Sketchup;;Edge if e.faces.length != 1 togos << e end end end gents.erase_entities(togos) # now add back original edges o_points = [] face.outer_loop.vertices.each{|v| o_points << v.position} gents.add_face(o_points) ### END CODE BY KAREN WALKERMAN
I've also added a method:
def self.get_90_trans(face,edge,p,length) if edge.reversed_in? face t = Geom;;Transformation.rotation(p,face.normal,Math;;PI/2) else t = Geom;;Transformation.rotation(p,face.normal,-Math;;PI/2) end trans_vector = edge.line[1].transform t trans_vector.length = length #Vector3d_Functions.round_vector_keep_length(trans_vector,6) new_t = Geom;;Transformation.new(trans_vector) return new_t end
what's the best way to test this further and (if successful) integrate it into the code?
I gather that with the updates to the native offset tool, people are probably not using this tool directly anymore, but for me it is helpful to be able to call an offset programmatically.
-
@TIG It'd be Genius Offset if it could perform in 'extend mode' (via modifier key - Alt, Ctrl..)
Advertisement