It would be nice if the Ruby console could remember its size between calls and sessions.
When I close and reopen it in one session it always gets a default size.
The same is with separate sessions.
Posts made by HPW
-
Ruby console remember size between calls and sessions
-
RE: Fastest way to select component by definition.name
Thanks for both valuable Tips.
I am making slow progress in learning SU-ruby and importing my Autocad-Models in a half-automatic fashion.
Just finished a Autolisp-Function to write ruby-scripts to TempDir with attributs for non-editable DC's.
(I noticed a few problems with DC attributes. Capital letters in field names are not liked by the DC, and also german Umlauts gives problem, they has to be converted to HTML syntax)
A ruby function restored the block-hierarchy using groups.Now I will have a look at setting interact behaviour to this components.
By the way: An idea to move component axes by ruby-code?Regards
Hans-Peter
-
Fastest way to select component by definition.name
What is the fasted way of getting a component by its definition.name?
Must I iterate through the entities every time:entities=model.entities entities.each{|c| mylist.push(c) if c.definition.name=="WantedComponentname" }
-
RE: Group components from array
@unknownuser said:
Ruby is kind of cool in that you can increment Strings.
Thanks Jim for the tip.
In this case I can not use it, since my block-numbering-steps comes from the imported autocad-blocknames.
But maybe it gets usefull in the future.@unknownuser said:
Do whatever works for you best...
Thanks again TIG.
Hans-Peter
-
RE: Any free autorun cd creation software?
May be other people do not use a one-click solution (free).
On windows I edit a file autorun.inf and use whatever development system I like.
(delphi,powerbasic,neobook etc.)autorun.inf
[autorun] open=MyLauncher.exe icon=MyLauncher.exe,0
Then the launcher and the autorun.inf get burned on the CD together with all the other stuff.
With enabled autorun the MyLauncher gets started when you insert the CD. -
RE: Group components from array
Another observation: The first solution seems much faster.
When I leave the outliner open and run the code, the outliner flickers as long the code run.
But the first is much faster than the second one. -
RE: Group components from array
Very convincing reason!
But is the warning in the doc correct of from an older version of SU.
Both shows me an identical result.
The first version is one code-line shorter. -
RE: Group components from array
@unknownuser said:
I think this is what you want ?
Thanks TIG, works also nicely.
But what is now the better or safer solution?Hans-Peter
-
RE: Turn component into non-editable DC
The sample 'Make Sang Red' from here:
might help:
# Add a new configurable option to Sang. # (Any attribute that starts with an underscore # is a "meta attribute" that describes behavior.) sang_def.set_attribute 'dynamic_attributes', 'weight', '145' sang_def.set_attribute 'dynamic_attributes', '_weight_label', 'weight' sang_def.set_attribute 'dynamic_attributes', '_weight_formlabel', 'My Weight' sang_def.set_attribute 'dynamic_attributes', '_weight_units', 'STRING' sang_def.set_attribute 'dynamic_attributes', '_weight_access', 'TEXTBOX'
Not sure if this would enough to make a normal component into a DC!
Will try. -
Turn component into non-editable DC
My Autocad-blocks have an extensive set of EED-based attributes stored at the block-instance.
On Export/Import in SU they gets lost and I ended with a simple component without any info/logik.
But it would be no problem to setup a parallel info-file with autolisp to transport this information. The blockname would be the reference key.So is it possible to turn a component into a DC with ruby?
In the first step it would be nice when I could set up the attributs in a non-editable way.
So a user could use the 'Component options' button and click on my component and the Component options web dialog would open and show the stored attribute and non-editable values (greyed-out).
That would allow to import additional info about this component, without the need of a full blown DC-Logik behind it.Ot cource adding Interaction-logik to use with the interact tool will be the next wish.
Other threads here in the forum mainly do reading attributes or set existing attributes.
So whats the real difference in the SU-database between a component and a DC ?
The existence of the attributes? Any flags?Regards
Hans-Peter
-
RE: Group components from array
Anyway I give it a try and it works nicely.
grouplist.each{|c| str = '@my_group_list = GroupPrefix'+ c eval str group = entities.add_group(@my_group_list) group.name = '<['+c.rjust(5)+'>' }
By the way: Is there a better way to create dynamicly array names and recall them?
The Grouplist is an array of strings like [ "100" "200" ...]
The Group-arrays are like 'GroupPrefix100' etc. -
RE: Group components from array
But waht about the quote in the doc:
@unknownuser said:
NOTE: calling add_group with entities in its parameters has been known to crash SketchUp. It is preferable to create an empty group and then add things to its Entities collection.
-
Group components from array
When I import a Autocad DWG my blocks get components in SU.
The outliner show them in his list.
Now I want to group some components together.
(like manual selecting them and choose 'Make Group')
I get it so far that I have an array of all wanted groups
and an array for each group with the wanted components.
With this code I create the empty groups:grouplist.each{|c| group = entities.add_group group.name = '<'+c.rjust(5)+'>' }
The empty groups show up in the outliner at the expected positions.
But how do I add the existing components from array to their groups? -
Ruby Sketchup keyword list syntax highlighting
Hello,
For an external editor (Ultraedit) I want to setup a sysntax-highlighting for SketchUp.
A list for the generic part of ruby is available, but the SU specific part is missing.
So does a keyword-list for SU classnames/methods and other specific keywords exist?Regards,
-
Ruby console shortcut act as a toggle
I can assigned a shortcut to open the ruby console. (I used F2)
It would be nicer when I could use this shortcut also to close the dialog.
(So the shortcut acts as a toggle.) -
Ruby console size not saved permanently
I can resize the ruby console to a different height and width.
When I close SU7 then the console opens to this new size for the first call.
But when I open it a second time via menu then it gets reset to original size.
This also happens when I resize the console and close it and reopen it. -
RE: DoubleCAD XT, free commercial use 2D detailing app.
@unknownuser said:
If we implement LISP it might be nearly impossible to make it very highly compatible with existing AutoLISP scripts, so that makes us hesitant to implement LISP. We're still taking input if you have suggestions and opinions!
It might not be highly compatible (for example compatibel to the latest VisualLisp improvments) but it should be compatibel to the early AutoLisp's.
But also important is any kind of scriptable GUI. So a DCL-compatible solution would be a wellknown Standard. (Intellicad and their clones support this mostly)Also SketchUp with its Ruby-API has a web-based GUI included.
But there are also alternatives like FxRuby etc.So keep us informed what (and when) language will get into your products.
My personal vote:
1.Lisp
2.Ruby -
RE: DoubleCAD XT, free commercial use 2D detailing app.
Is DoubleCAD STD or PRO in any way scriptabel like Autocad with AutoLisp/DCL ?
Regards
Hans-Peter
-
Ruby console scrolls to top on commandstart
When I have a longer console-log and start a command like:
UI.messagebox("Test")
then the dialog 'SketchUp' show up with the text.
But the console-window scrolls to the top in that moment.
I does not see my context of the called dialog any more.
When I return from the dialog the console scroll to bottom again and shows the returned result.Thats an odd behaviour and makes debugging not easier.
(I used only a trivial example here, I think about more complex external calls)Regards
Hans-Peter
-
RE: Sketchup.version vs. Sketchup.version_number
@unknownuser said:
Yea, I think it might be worth mentioning this to the SU team.
Does they read it here, or must someone take more action/bug report?