path = Sketchup.find_support_file "/Plugins/rectangle#1.skp"
works (with /), as does...
path = Sketchup.find_support_file "rectangle#1.skp"
IF it's in the base SUp folder
(PC only)
path = Sketchup.find_support_file "/Plugins/rectangle#1.skp"
works (with /), as does...
path = Sketchup.find_support_file "rectangle#1.skp"
IF it's in the base SUp folder
(PC only)
After you have auto-placed the grp containing the 3d-text you need to rotate it in Z, then so it's vertical. You need to make a "rotation transformation"...
transformation=Geom::Transformation.rotation(anchor_point,vector_axis,angle_radians)
e.g. for a right-angle about Z try -
rotate=Geom::Transformation.rotation(pointN.[0,0,1],90.degrees)
e.g. for a right-angle about Y try -
rotate=Geom::Transformation.rotation(pointN.[0,1,0],90.degrees)
etc
Mess around to find which you need for which group...
See my TextTag script that does this. The 3d-text is grouped, it appears at 0,0,0, it's then transformed to where you want it, snapping to faces etc as desired...
http://www.sketchucation.com/forums/scf/viewtopic.php?f=57&t=2954&p=20077&hilit=texttag#p20077
Pilou
To make a circular (helical) stair you need to use Grow.rb. Here's a Tutorial on making a spiral/helical staircase...
Find my 'Matrix' tool this does 1d, 2d and 3d arrays with rotation and scaling, and randomness if required.
My 'Grow' is more for organic forms...
There's also RickW's CopyAlongPath tool...
@jim said:
Oh, I see, but I am starting with a blank model - there is nothing to add to the bbox.
Then make the temporary bbox far bigger than you'd ever expect the drawn geometry to be ?
Clear the temp bbox at the end and the model's bbox then becomes the bbox of the geometry you just made ?
@jim said:
Thanks TIG,
I still don't know how to calculate how big to make the bounding box. Maybe I can use the camera distance to origin as an estimate...
Why not get the model's bounding box and x10(0)(00) its min and max ? IF you know how big you are making the geometry then you should be able to make a point equal to where you are defining (or picking) and that'd enlarge the bounding box to suit ?
See http://download.sketchup.com/sketchuphelp/gsu6_ruby/Docs/Ruby-BoundingBox.html#new
Make a new bounding box - 'new', then 'add' a min point and a max point to it that are well away from where you are at, and you are then drawing geometry within the bbox...
You could dynamically add points to the bbox as you move your cursor to ensure that you are still within the bbox ?
If you don't make abbox that's the size of your geometry you can get weird things with groups etc. In the past I have drawn a long diagonal line, which makes the bounds increase and then erased it later BUT the 'add' a point method works...
@wikii said:
Hi all,I want to get the Group object that contains the selected objects.
such as:
> First I select a Group
> Sketchup.active_model.selection[0] => <Sketchup;;Group;0xb79eb20>
> I open it ,and ,select an edge
> Sketchup.active_model.selection[0] => <Sketchup;;Edge;0xb79ea48>
> Now I want to get the Group object contains '<Sketchup;;Edge;0xb79ea48>' ,that should be '<Sketchup;;Group;0xb79eb20>'.Using 'parent' methods,it can't work at all.
> Sketchup.active_model.selection[0].parent => #<Sketchup;;ComponentDefinition;0xb79e958>
>
Please help me.
So far so good, you have the ComponentDefinintion. Let's say you set it to 'cdef', then
cdef.instances[0] will return the group you want - there's only one instance of a group's component-definition - I know it's convoluted !!!
NOW you have the parent of the edge... = the group ?
Or put another way - you want a method something like:
ComponentDefinition.export
or
ComponentDefinition.save_as
...
I'll look at the possibilities... I know that a selected SectionPlane can be moved using a transformation... a la Nudge.rb. BUT how we find which one is the active section cut and then move with the arrow keys needs investigation. Unfortunately the API on the SectionPlane is notoriously scant...
Watch this space...
I think that was partially my idea... http://groups.google.com/group/Ruby-API/browse_thread/thread/ac8c752034f58b62/7a98e0e3acc3aae1?lnk=gst&q=dimension#7a98e0e3acc3aae1
Well done to develop on it... it's only taken 'us' nearly two years !!!
Is it to become a useful bit of code ?
It's been said...
You can't edit the SUp base materials in the browser.
BUT you CAN edit the model's materials (see 'little house' button in browser).
IF you have made a material in a model that you want to be accessible to any future models - via the 'base set' - then do a "Save_As" of this new material (in the model's material browser window select it and right-click to get a context menu...). Put it with only similar materials in your Materials folder structure... New models get access to it...
@tim said:
Although the cutlistandmaterials.rb creates an amazingly useful spreadsheet it writes it to a realyl dumb place; not by design but because the filename is constructed by
namecsv = mpath + "/" + mname + "-CutList.csv"
and 'mpath' is found with
mpath = Dir::pwd
Sadly on my Mac this appears to prodcue an empty string since the .csv file is always written to the root directory and not to somewhere useful like, say, the same directory that the model came from.
Is the Dir::pwd method simply wrong on a Mac? Is the plugin using the wrong way to find the path?
Change the line...
mpath=Dir;;pwd
to...
mpath=model.path.split("\\")[0..-2].join("\\")if model.path
That will save the list in the same folder with the model, using it's name+suffix - if you haven't saved the model then it's 'root' again...
@jclements said:
I was watching an inhouse presentation of some design concepts being proposed.
I had set up predefined sections for specific scenes as well as some scenes where the presenter could toggle on and off specific sections for any view. But, as always, discussions came up in which the current Section positions were not adequate.
Is there were a way to at least move a Scene's Section along its normal via the up-down cursor keys withOUT having to turn on Sections and use the move tool?. This could be very useful.
Some options for a more sophisticated script would be a persistent dialog in which:
a. the increment value could be modified (unless there could be a smooth continuous movement via keeping the cursor key depressed)
b. specific Sections could be chosen and change which are active and which are not.
c. Section colour and edge-thickness could be modified.
Why not make several Scenes (Pages) with the most likely required/requested Section Planes at [incremented] different locations and just swap between the scene/pages by picking the tabs during your presentation - you can even rename the tabs with the section names - Front-Office, Front-Reception, Front-Core etc... Side-Stair, Side-Foyer etc... With smooth scene/page-transition settings you can get a good animated effect that's also impressive... You also can change the way any section cut edges appear (both colour and thickness) for any individual scene (set a style for each ?) - this can even be set to be different for every scene/page if required...
Surely you'd investigate your concepts with several section cuts before making it all public... so why not take a few minutes setting up most of the sections likely to be queried beforehand. Whether you move your sections-cuts manually or with some clever ruby-gizmo (which is probably quite possible by the way) then making up sections on the fly leaves you open to either showing things that you don't want someone to see (perhaps some yet unresolved or un-modelled bits) or even worse, that you weren't aware of (something that doesn't really work (yet!)) - either way it's potentially embarrassing and unprofessional... Take charge of any presentation and have only those sections you are happy to be seen available to you during the presentation... If someone asks for something else then either say you'll do it later and send it on, OR if you're confident do it on the fly but having confidence in what you know of your model...
We could make a ruby to do what you ask but why use it when you can mimic it with a bit of preparation...
@watkins said:
Dear TIG,
Its me again (bad penny and all that).
Okay, adding .txt works fine, except that for long text files I can only see what will fit on the screen (no vertical scroll bars). I note that .pdf files open with scroll bars and so viewing them is just fine. I also have a lot of .txt files in my plugin folder and so when I try to select a file I can only view/select those that are visible in the text window. It would be useful if your script could be made to work like the Plugin drop-down menu, viz. the window opens and stays open with a single click and then items on the list are accessed (if required) using up/down arrows. This might be a useful feature anyway as users are likely to accumulate lots of .pdf help files with time.
Kind regards,
Bob
Making the top bar menu list is what takes the time and slows down any model opening - and it's what we are trying to avoid... It's a limitation of the current Ruby dialogs that long lists go off the screen. However if you type the first character of the likely file's name e.g. W for Windowizer_help then the list will jump to that (or at least near that) and scrolling down is then possible... This applies to lots of Ruby dialogs like ones listing layers or colours. It could be done better with a web-dialog... but others have that expertise (and time) - perhaps someone can clobber 'my' getting the list of files into 'their' web-dialog and make it run as a superior form of dialog... before the Ruby dialogs themselves get improved (if ever)...
@watkins said:
Dear TIG,
Do you think you could modify your script to include simple text documents? I ask because when I install a plugin which isn't supplied with a help/readme document (more recently a .pdf file), I create my own help/readme document by making a simple text file and then cutting and pasting any explanation posted with the ruby script. I now have quite a few of these 'readme' files and it would be really useful if I could access them from the Help drop-down menu.
Many thanks,
Bob
The problem is that many people add a .txt suffix to the end of the name of any scripts they don't want to have always loaded - they can 'load "script.txt"' through the Ruby Console later if needed. If the help script listed all .txt files these would come up in the list too. The formats that are found and listed are pdf htm html mht and doc - so you could make the txt files into doc ones ? OR you could make your help files end with a suffix .bob and set .bob files always to open with NotePad.exe; then edit the script and add ".bob" to the list of files it finds - easy to see how it works - and off you go...
@edson said:
TIG,
this is what happened to your script on mac: it seems to be working fine.[attachment=2:2kcjb1a2]<!-- ia2 -->PluginsListB_01.png<!-- ia2 -->[/attachment:2kcjb1a2][attachment=1:2kcjb1a2]<!-- ia1 -->PluginsListB_02.png<!-- ia1 -->[/attachment:2kcjb1a2]
So Edson, you are saying that my version works OK ?
Note: the reason mine lists one more help-file than the other version is that it looks in all of the sub-folders in the Plugins folder and lists any it finds in there too...