[Plugin] TIG-Smart_offset
130 posts
• Page 1 of 5 • 1, 2, 3, 4, 5
[Plugin] TIG-Smart_offsetAll Rights Reserved. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. TIG-Smart_offset.rb Offsets edges of a specified face by a distance 'smartly' TIG::Smart_offset.new(face, distance) Overview: A +ve distance offsets the face's outer_loop outside of the loop. A -ve distance offsets the face's outer_loop inside the loop. If the face's outer_loop perimeter contains a thin inlet or thin peninsula then twisted loops are avoided and trimmed off, only a single non-twisted new face and edge-set is created. New edges crossing other coplanar faces will split them as appropriate. Holes in the face or unconnected but coplanar faces that overlap with the new geometry might be 'infilled', just as with the native 'offset'. On completion it returns an array containing the original face and any new face[s] created or affected by the creation of the new geometry, or 'nil' if no face could be created - e.g. the face was too small to contain the internal offset loop using the given -ve distance. The new face[s] have the same front/back material and layer as the face itself. Some very convoluted faces with 're-entrant' forms and 'inlets' can cause failures, because a fully 'neatened' set of offset edges cannot be determined... Usage: For developers it can be used as a method to call from within their own scripts. Add a "require 'TIG-Smart_offset.rb'" line into your code to ensure it's loading, OR adjust the [modified] code to run only within your own Module/Class. Remember to distribute this file with your scripts, because users probably won't have it installed. f = Sketchup.active_model.selection[0] # or other method the define 'f'... fa = TIG::Smart_offset.new(f, 1.2) 'fa' returns as an array of faces - usually one face - created by the operation. 'f' remains as a reference to the original face, fa[0] etc is the newly created face - with a +ve distance fa[0] etc is the outer 'donut' ring ['f' is the inner face], in the case of a -ve distance it is the inner face ['f' is the outer 'donut'] OR from the 'Tools' menu > 'TIG.Smart_offset'. OR from the Context-menu > 'TIG.Smart_offset' . OR from the [activated] Toolbar > 'TIG.Smart_offset'. Which use the method: TIG::Smart_offsetter.dialog() In the dialog you enter the required offset in current units, [or add a units suffix for non-current dimensions]. A +ve offset is applied outside of the face's outer_loop and a -ve offset is made inside the face's outer_loop. It mimics the native offset-tool in most respects, other than removing many of the spurious twisted offset line/loops. Curves/Arcs are offset as curves in the new offset outline. ALL selected faces are offset by the distance specified. The last used offset distance is remembered during that session. It is one step undo-able for all offsets. Do not use with the Outliner open and rolled-down, as this may cause splats! Version: 1.0 20121221 First issue. 1.1 20121221 Made more robust. 1.2 20121221 Further robustness in enabling/suitable? [thanks to Jim!]. 1.3 20121221 Removed 'suitable?' method, to suit MACs, more error traps etc. 1.4 20121222 Validation on applied to PCs, to avoid MAC toolbar glitch, 1.5 20121224 Coding improved for truer, tidier offsets. 1.6 20121225 Curves/Arcs are now offset as curves in the new offset outline. 1.7 20121227 Further glitches and convoluted offsets trapped. 1.8 20121228 Single welded curve loop offsets correctly. Fixed typo in weld. 1.9 20121230 Error in code when called within another script fixed. 2.0 20121231 Further refinements and glitch trapping. 2.1 20121231 Glitch trapping extended to curves. 3.0 20170510 Made compatible with newer versions... Donations: By PayPal.com to info @ revitrev.org TIG
Re: [Plugin] TIG-Smart_offset v1.0 20121221Merry Xmas to you too.
Nice tool There's a frontroom and a backroom....reverse faces
Re: [Plugin] TIG-Smart_offset v1.0 20121221Awesome TIG! Thanks for this one,
Chris
Re: [Plugin] TIG-Smart_offset v1.0 20121221Tahnks for the gift before the end of world !
![]() Seems marvellous but...(maybe I miss something ![]() The bow tie must not be disapear ? (Normal Offset = Native Offset, Nothing = TIG_Smart_Offset ) Sorry for the inconvenience ! ![]() Last edited by pilou on Fri Dec 21, 2012 12:54 am, edited 1 time in total.
Re: [Plugin] TIG-Smart_offset v1.0 20121221Pilou
There is a Ruby Console error message saying it can't be done [clearly it can !] I knew there was as reason I had never released this code ! Now I need to find out what's wrong with it ?? Merry Solstice... TIG
Re: [Plugin] TIG-Smart_offset v1.0 20121221Bon courage!
![]()
Re: [Plugin] TIG-Smart_offset v1.0 20121221undefined method `suitable?' for TIG::Smart_offsetter:ModuleError Loading File TIG-Smart_offset.rb
undefined method `suitable?' for TIG::Smart_offsetter:Module but worked to a degree, the new border and face are separate and I can't seem to get them to merge with the original face? john learn from the mistakes of others, you may not live long enough to make them all yourself...
Re: [Plugin] TIG-Smart_offset v1.0 20121221Strange there is a method called that ? It checks selection for suitability and affects how the menu, toolbar and context-menu items display/enabled... Are you on MAC ? Was there a line number with that error ? I'm about to issue v1.1 to resolve Pilou's tolerance issue... I'll swap some code around to see if making that method earlier fixes it for you... Let me know whatever you can... ![]() If it's still an issue a sample SKP might help... TIG
Re: [Plugin] TIG-Smart_offset v1.1 20121221Here's v1.1 viewtopic.php?p=446462#p446462
It's been made more robust. It now works on Pilou's problem shapes! TIG
Re: [Plugin] TIG-Smart_offset v1.1 20121221Hi Tig,
I'll try the new one but something really odd is going on, and yes I'm on a mac. I used SU to instal, and had line numbers then, so I removed it from 'plugins' to do again, but this has been uninstalled, moved to trash, emptied trash, restarted computer, but it still there and it works, as well as it did, although sketchup can't find the file.... it's crazy, I don't have hidden files either. I'll over write with the new john learn from the mistakes of others, you may not live long enough to make them all yourself...
Re: [Plugin] TIG-Smart_offset v1.1 20121221found it, a new 'finder. replacement doesn't update instantly... bin that
ok no errors. menu cmd works, context cmd work, toolbar cmd dosen't do anything It works if I split if the validation proc cmd2=UI::Command.new('TIG.Smart_offset'){self.dialog()} cmd2.small_icon=File.join(dir, 'TIG-Smart_offset.png') cmd2.large_icon=File.join(dir, 'TIG-Smart_offset.png') toolbar=UI::Toolbar.new('TIG.Smart_offset') toolbar.add_item(cmd2) john learn from the mistakes of others, you may not live long enough to make them all yourself...
Re: [Plugin] TIG-Smart_offset v1.1 20121221You have no idea how many times I got frustrated doing an offset and have to get in there and clean up the shape. Thanks TIG!
i7-4930k @3.4/3.7GHz, 32Gb RAM, NVidia GTX 980Ti 6Gb, Windows 7 Pro 64bit
Structural Integrity is Not Just Physical...It's in the Design and Purpose Re: [Plugin] TIG-Smart_offset v1.1 20121221i'm all greyed out (on two separate computers with different OS & different versions of sketchup on them).. will investigate more tomorrow
dotdotdot
Re: [Plugin] TIG-Smart_offset v1.1 20121221Merry Christmas to you too!
Welcome to try Thea Render, Thea support | kerkythea.net -team member
Re: [Plugin] TIG-Smart_offset v1.1 20121221in cmd.set_validation_proc (and other places) you want to give the full scope of the suitable? method since it is being called from SketchUp outside the scope of your module.
Also, combine the MF_ bits.
Hi
Re: [Plugin] TIG-Smart_offset v1.1 20121221Nice gift! Thank you and Merry Christmas! (Are we allowed to use it before 24.12.?)
Re: [Plugin] TIG-Smart_offset v1.1 20121221Yeeeeeeees! Works like a charm now!
![]() You are the Ruby's king! ![]() And lucky because I can't more test your tricky plugin before the next year! ![]()
Re: [Plugin] TIG-Smart_offset v1.1 20121221Thanks, knew it was obvious... This only affected MACs though ??? This was collecting dust on a virtual dust, until Pilou reminded me that I'd written it, so sometimes things get 'forgotten'... ![]() TIG
Re: [Plugin] TIG-Smart_offset v1.2 20121221Here's v1.2 viewtopic.php?p=446462#p446462
Further robustness in enabling/disabling/graying and suitable? tests [thanks to Jim!]. Seems to be especially for MACs ![]() TIG
Re: [Plugin] TIG-Smart_offset v1.2 20121221
I am not sure - it was just a guess and I don't have a Mac. Did you try it? ![]() Hi
Re: [Plugin] TIG-Smart_offset v1.2 20121221I don't have a MAC either.
![]() Driven's reported issue was on a MAC and Jeff had other issues on a MAC too... Hopefully this recent v1.2 [...20121221b.rbz !] will address the suitable? check and MF_ issues with the menus/toolbar... It still works fine on a PC, but then v1.1 did too ![]() ![]() TIG
Re: [Plugin] TIG-Smart_offset v1.2 20121221Nice Christmas gift Tig, thanks a lot, it works perfectly on my Mac.
Re: [Plugin] TIG-Smart_offset v1.2 20121221
TIG: Merry Christmas I come from China, is to learn
Re: [Plugin] TIG-Smart_offset v1.2 20121221
Hi Tig i'm still getting the same greyed out problem. is there anything i can type in the console or ?? to help figure out what the problem is? thanks dotdotdot
Re: [Plugin] TIG-Smart_offset v1.2 20121221Is there no difference at all - if you have nothing preselected, or one edge preselected, or one face preselected, or lots of things [including some edges] preselected ?
The menu/toolbar are only enabled if there's at least one face in the current selection. The context-menu only appears if there's at least one face in the current selection. Copy/paste+<enter> these into the Ruby Console and report the results: with nothing preselected TIG::Smart_offsetter.suitable?() with one edge preselected TIG::Smart_offsetter.suitable?() with one face preselected TIG::Smart_offsetter.suitable?() with lots of things [including some edges] preselected TIG::Smart_offsetter.suitable?() with one edge preselected TIG::Smart_offsetter.dialog() with one face preselected TIG::Smart_offsetter.dialog() ![]() TIG
Re: [Plugin] TIG-Smart_offset v1.2 20121221oops
![]() it actually is working now.. it's just the toolbar that remains greyed out at all times but the menu item becomes available once an appropriate selection has been made.. (which, for me personally, is fine.. i more likely than not wont want the toolbar anyway.. i think id use it with a modifier key added to my offset shortcut) dotdotdot
130 posts
• Page 1 of 5 • 1, 2, 3, 4, 5
|