[Plugin]ArcCurve-set_segments.rb & changearcsegments 130830
32 posts
• Page 1 of 2 • 1, 2
[Plugin]ArcCurve-set_segments.rb & changearcsegments 130830### ArcCurve-set_segments.rb
### (c) TIG 2009-2013 ### Adds new method to ArcCurve to change number of segments - ### like in the Entity Info dialog... ### Usage: arc.count_edges >>> 12 ### arc.set_segments= 36 ### arc.count_edges >>> 36 ### It will NOT work on arcs with attached face(s) that are NOT 'coplanar' - ### either with the arc or with each other. ### Connected faces with orientation, materials, holes etc are retained. ### 20090522 First issue. ### 20090928 Added the ArcCurveTests, remakes Arc, Circle or Ngon. ### 20091002 ArcCurveTests improved. ### 20110216 Clashes with other methods fixed. ### 20120121 Put inside TIG module and Plugins menu item added. ### ### TIG.changearcsegments NNN ### ### changes all arcs/circles in selection to be NNN sided ### e.g. to smooth selected arcs in an imported dxf plan... ### large selections with many segments might take a while to run... ### Usage: In the Ruby Console type TIG.changearcsegments 64 ### All Arcs/Circles within the current Selection will now have 64 sides... ### OR use Plugins menu item and enter number in the dialog... Download the latest RBZ version from the SCF PluginStore or through the SketchUcation Plugin Store toolset from within SketchUp itself... Last edited by TIG on Fri Oct 02, 2009 9:17 am, edited 2 times in total.
TIG
Re: [Code][Plugin]ArcCurve-set_segments.rb & changearcsegmentsTIG! That's great! This has been sorely needed in the API. I've already forgotten all the scripts that have been requested that needed this feature. Thanks soo much for this one!
Chris
Re: [Code][Plugin]ArcCurve-set_segments.rb & changearcsegments![]() I ADD THESE TO IT #def changearcsegments(segments) def changearcsegments model=Sketchup.active_model name="Change Arc Segments" ##================ $ff_edges = 1 if not $ff_edges prompts = ["Change Arc Segments: "] value = [$ff_edges] result = inputbox prompts, value, "Change Arc Segments" return if not result $ff_edges = result[0] segments=$ff_edges ##================ if Sketchup.version.split('.')[0].to_i >= 7
Re: [Code][Plugin]ArcCurve-set_segments.rb & changearcsegmentsThat's fine - it's code that's to be used freely - please just credit me where credit is due and don't sell it.
![]() Incidentally, I'd use @ff_edges [which sets it for that session for that script], rather than $ff_edges [which sets it globally for all loaded scripts that session and could clash if someone else has used it ! ] Why not also add some more code to make it a Plugins-Menu item or better a right-click Context-Menu item that gets shown only if the current selection contains an ArcCurve - a bit like the arc_center_point ruby? I was just demonstrating a possible use for the new method - you can puzzle over it and add any fripperies you like... ![]() Post your version when you're done - I suggest you call it something a little different to avoid script clashes... TIG
Re: [Code][Plugin]ArcCurve-set_segments.rb & changearcsegments@ TIG: Cool Now with the Console I will be try this tricky code!
![]() Or maybe I am optimistic and some more code must be written ? The console use + code above are sufficient? The plug is "stand alone"? Edit: I Try the Console: works fine ![]() And works also for the circles! ![]() Bravo! ![]()
Re: [Code][Plugin]ArcCurve-set_segments.rb & changearcsegments![]() TIG The script I add just copy from the projectnormalface.rb. I try the @ff_edges it work well ![]() Incidentally, i call scripts through the usertoolbar written by Jim ,so the ruby files i use no menu or button script (i delete them ![]()
Re: [Code][Plugin]ArcCurve-set_segments.rb & changearcsegmentsFor the volumes 3D from Autocad does it possible to make the same thing?
Something like this in the Widows box option of SU importation : give minimum angle between facets (so numbers of segments of arcs will be limited by this value) But I don't know how is managed entities ![]() I suppose 2 circles connected but... ![]() here a cylinder from autocad
Re: [Code][Plugin]ArcCurve-set_segments.rb & changearcsegmentsUnfortunately SUp doesn't allow [easy] editing of many of the properties of arcs or circles it they form parts of complex 3D shapes... Changing an arc or circle could change so many other things that are connected to it that it would quickly become unmanageable ! So, you cannot change the number of segments in an arc or circle using Entity Info IF it has connected faces that aren't coplanar with the arc/circle itself... My new 'method' has the same limitations...
Sorry... TIG
Re: [Code][Plugin]ArcCurve-set_segments.rb & changearcsegmentsWell, Nevemind!
![]() Maybe something to make by "exploding" object in Autocad ![]()
Re: [Code][Plugin]ArcCurve-set_segments.rb & changearcsegmentsAll this don't arrive if you use Moi
![]() Here a simple cylinder with a hight number of segments ![]() (limit of the 24 segments default is overpassed ![]() And you can control the aspect of polygons before exportation! Exportation is in SKP format of course! ![]()
Re: [Code][Plugin]ArcCurve-set_segments.rb & changearcsegmentsThat is one of the key differences of solid modeler vs. face modeler.
Re: [Code][Plugin]ArcCurve-set_segments.rb & changearcsegmentsHere is an updated version viewtopic.php?p=158903#p158903
e.g. arcCurve.set_segments=6 You will need both of the rubies that are attached there... The new file, ArcCurveTests.rb, includes three new methods is_loop?, .is_circle? and .is_polygon? - these methods are not accessible through Ruby otherwise... They are used to determine the original ArcCurve's underlying 'type' [Arc/Circle/Polygon] and then use that to remake the geometry with the new segment/sides count as the right 'type' [previously any Circles/Polygons that were changed by this method became 'Arcs' !]... EDIT: ArcCurveTests.rb updated... 20091002 TIG
Re: [Code][Plugin]ArcCurve-set_segments.rb & changearcsegmenSome of these methods can be simplified with the aid of Curve.is_polygon? added in Google SketchUp 7.1 - Maintenance 1.
Here's a set I made for my TT_Lib:
SU versions prior to this .is_polygon? will not be able to tell a Circle or Polygon apart, but no error is thrown. Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
[Plugin]ArcCurve-set_segments.rb & changearcsegments 110216Here's an updated version that avoids other method clashes... viewtopic.php?p=158903#p158903
IF you have the older script ArcCurveTests.rb installed please remove it as it might clash with some other methods... TIG
Re: [Plugin]ArcCurve-set_segments.rb & changearcsegments 110great! great! great! that is what i was looking for!!!!!!
thank you... ![]() Re: [Plugin]ArcCurve-set_segments.rb & changearcsegments 110I've tried making a script that automatically creates an 8-sided circle in a group at sketchup start, to see if all circles created by a user would then be 8-sided as well. They aren't - scripting an 8-sided circle still leaves the default sides at 24.
![]() I tried changing the sides of a circle with this script as well - Sketchup still leaves the default at 24. How can I change the default sides of a circle? ![]()
Re: [Plugin]ArcCurve-set_segments.rb & changearcsegments 110![]() At least this script here just saved me time reducing polys from extruded circles.. thanks! Re: [Plugin]ArcCurve-set_segments.rb & changearcsegments 110TIG it's nice of you to share this with us. I think this ruby is very useful but it's convenient to use because everytime I have to type "changearcsegments NNN" in the ruby console...Why not make it possible to be added in the plugin menu and works with a popup window to type in the segment number.
Re: [Plugin]ArcCurve-set_segments.rb & changearcsegments 110Edit the script with a plain-text editor [Notepad/Notepad++.exe] and add this code at the end
TIG
Re: [Plugin]ArcCurve-set_segments.rb & changearcsegments 110
![]() Re: [Plugin]ArcCurve-set_segments.rb & changearcsegments 110Hi!
Is Anyone so kind to tell me how to use this plug-in. I get an error that says Error Loading File ArcCurve-set_segments=.rb no such file to load -- ArcCurveTests.rb any help? thx! p.s. I downloaded the script from the first post. Re: [Plugin]ArcCurve-set_segments.rb & changearcsegments 120It doesn't even use ArcCurveTests.rb or mention it in its code - in fact in earlier posts [in this thread] you are recommended to remove that very file from your Plugins folder, because changes to the API have meant that it might clash and updates of this tool no longer need it anyway.
So it is not 'required' by the recent versions of this script... Your error message leads me to think that you have an old version of the tool loading... Are you sure you have got the latest one in the Plugins folder? Windows Vista/Win7 can 'play tricks' if you don't have full access rights to the Plugins folder - it looks like you have added/updated a file/subfolder... but there's a 'Compatibility Files' button added to the folder's window-bar and they have actually gone into a side folder, IF you haven't got full security access rights to a folder [right-click context-menu Properties > Security] Here's the latest version viewtopic.php?p=158903#p158903 It has the Plugins menu item added to the code as discussed a few posts back... Download the latest file from this link. It should make a Plugins menu item which opens a dialog into which you type the number of arc segments required to process all selected arcs/circles... TIG
Re: [Plugin]ArcCurve-set_segments.rb & changearcsegments 120Hi!
I downloaded the plugin and istalled it. I have a big drawing with many arcs and is nearly impossible to select them all. So i select the whole drawing as i imported it and then i use the plugin. But the plugin works only with some of the arcs and the others remain with the default number of segments. How can i use the plugin on all the arcs? Thank you in advance. Re: [Plugin]ArcCurve-set_segments.rb & changearcsegments 120SketchUp's Arcs/Circles can have their 'segmentation' set as they are made OR later on by using 'Entity Info', OR bu using this tool.
BUT Arcs that have been scaled, exploded into edges OR are now incorporated into 3d geometry [extrusions etc] are never changeable. So if you can't change your Arc's segmentation using 'Entity Info', then you can't change it with anything else either: its properties have been fixed by your earlier actions. TIG
Re: [Plugin]ArcCurve-set_segments.rb & changearcsegments 120I can change the segmentation from entity info but the arcs are too many. So I tried to select the whole drawing and change the segmentation with the tool but only few of the arcs got the segments I wanted.
Re: [Plugin]ArcCurve-set_segments.rb & changearcsegments 120Wireframe mode will avoid picking faces, then select-by-fence, missing out anything that is obviously not an edge/curve...
Any errors in the Ruby Console ? TIG
Re: [Plugin]ArcCurve-set_segments.rb & changearcsegments 120Thank you for your instant replies.
I don't have any faces in my model. I don't really understand what you mean with the fence selection. (This is my first model in SketchUp ![]() I don't get any errors at all. I just select all the lines and arcs (because i said in the first post that it is impossible to select every arc with clicks), then i use the plugin and i set the desired number of segments. Unfortunately not all the arcs get the number of segments I set in the plugin dialog box. Re: [Plugin]ArcCurve-set_segments.rb & changearcsegments 120Can you attach your SKP to a post so we can see what's up...
TIG
Re: [Plugin]ArcCurve-set_segments.rb & changearcsegments 120Thank you for your will to help me. As I understood the plugin can handle max 100 arcs at a time. I partially selected the whole model and everything was ok!
32 posts
• Page 1 of 2 • 1, 2
|