Not possible as far i remember, i had the same question. But maybe things have changed.
Posts made by th3lurker
-
RE: Set layer color with code possible?
-
RE: Ruby Script for Adding up length of Edges
Haven't rubied'in a while, so i'll have to remember the syntax, but until then:
For each entity in selection array, if it's a sketchup edge, totalLength = totalLength + edge.length ?
-
RE: The new? Trimble Sketchup SDK
Sorry if i seem lazy, i could probably figure all of this myself if i spent enough time looking at the documentation, but i figured one of the developers can give me more insightful info.
So i've made a list of things i need to do, if it's not too much to ask can you tell me if these functions are implemented? Is everything i see in the http://www.sketchup.com/intl/en/developer/su-api/globals_func_0x73.html#index_s list operational?
I'll try to keep it in a "chronological" order
Edit: 0. One click export. Click a button in our UI and:- Open a specific .skp file (we use templates)
- Create new named layers and set entities' layers
- Create a tree structure of named groups, some containing named entities
3b.Iterate through the tree structure to find a certain group(stupid question, but still). - Create new faces and add custom textures on them, position and stretch texture material, set opacity
4b. I used to create new faces using a mesh(because of speed issues), but this poses several problems. The face does not "exist" until i use fill faces from mesh, so i have to store the texture information separately. Fill from mesh erases all entities that existed previously in the group, so i have to wait until i am sure i have no more faces to add to the mesh. Could i use SUFaceCreate instead? Like i said, speed is an issue here, some of out projects have thousands of entities, and 10+ faces/ entity is not uncommon. - Set edge smoothness
- Locking the group is not that important
- Save the file
- Are the .skp's backwards compatible?(sketchup8, maybe even 7, i have no real idea what the clients use).
Sorry for disturbing you again.
-
RE: The new? Trimble Sketchup SDK
That's great news Bugra, but could you be a little more detail what you meant with "It is not yet as fully featured as the old SDK was, especially for creating skp files"?
Cause i would like to use it, but only when i am certain i can implement everything i need to implement.
Basically i need to create a few (thousand) volumes, split then in named groups and subgroups, set them on named layers, place and position non-standard external textures(.png) on most of the faces, smoothen some edges. Probably set some edges to invisible, because of triangulation and all. Lock a group, name the skp. There's probably a lot more, but i need to revisit my code to sure. We are on very different time zones so i am writing from home, hoping i find an answer in the morning.
Cheers -
The new? Trimble Sketchup SDK
Hi!
Been gone for a while, and i am not really up-to-date on the news. So this is more of a please help me understand the situation, rather then a technical question. I developed an exporter some while ago, which had (and still has) problems. Most of them related to having to use ruby as the export tool(writing to a temporary file and then reading and interpreting it in ruby and creating the .skp, using a Sketchup itself).
While a C++ SDK existed while Google owned Sketchup, they were clear that they would not support the kit, and thus we chose Ruby.
But now, checking around again it seems Trimble has deprecated the old SDK and created a new one? I mean http://www.sketchup.com/intl/en/developer/su-api/index.html.
Is it reliable? Is it usable? What can you guys tell me about this SDK?
Thanks -
Online model generation using ruby
Just treading the water here.
I know all of this is possible offline.
I've been wondering if it would be possible to generate an image of a sketchup model using online input. Eg: A client wants to see what a box would look like if it was 2 meters long am 15 cm wide. Inserts data, clicks generate, bla bla bla, render appears.
And i suppose this would require me to buy a copy of SketchUp Pro, for how much does one go around these days?
I know there must be dozens of other options to do this, but i have next to no experience in web programming, i could easily do it in ruby. -
RE: Set group parent - How to?
Sorry, i was away for a few days. No, i don't have the time at the moment to post code, but i basically goes like this. I'll use Floor 0/ Wall 1/ Window/ Left Window Frame as an example.
I have no idea how many volumes will be added to Left Window Frame until i have completed reading the file. This is important because entities.fill_from_mesh erases everything in the entity it is called from. So i create two "parallel" tree structures, one containing the groups (EG:Floor 0/ Wall 1/ Window/ Left Window Frame &Floor 0/ Wall 1/ Window/ Right Window Frame) and another containing the mesh, texture data for each face, other stuff and a "pointer" to the group this is supposed to go in to. When i finished reading all the data i start using it and create and fill each group.entities with the mesh, then i apply the information to the textures. The most timeconsuming in this is, by far, entities.add_group, taking up to a full 0.5 seconds when the number of groups jumps past 1500. I was hoping i could create an empty project with ~2000 empty groups, which i could just juggle around to create the exact tree stucture i need. There is no "stardard" tree structure for any of our projects, a wall might contain none or dozens of windows.
I also understood that the c++ sketchup sdk is no longer supported, so we didn't take the risk to invest time in that. -
RE: Set group parent - How to?
@thomthom said:
You cannot set the parent of a group or component. A group is in reality a special component instance - it even have a definition: http://www.thomthom.net/thoughts/2012/02/definitions-and-instances-in-sketchup/
You can insert a new instance of a group in a new context using Entitie.add_instance - then delete the original, but that's the closest you get. But I wouldn't think that would be any faster. And you cannot create parent-less group or component instances.I see, i have no idea of the process behind moving a group inside of the outliner, it may well be a copy-paste operation.
@thomthom said:
Are you using OSX? (Please fill out your profile with system information.)
There was a bug there I think related to adding groups that was fixed.I'm on windows, and i managed to track the slow-down to the number of groups in the project, but now it seems to work a lot faster. Sometimes we reach numbers of 2000+ volumes, each in an individual group, plus a couple of dozen other groups that make up the parents of these volumes, though they don't contain any drawable entities, just other groups. Exporting could take up to a full two minutes on these projects. I've even had crashes. I would gladly share the code with you guys, i'm sure you'd greatly improve it, but i am not allowed to.
-
Set group parent - How to?
This is probably a no brainer, but searching "set parent" "set owner" didn't return anything.
Thing is, i still have some issues with add_group's speed as the number of groups in the model increases. So this idea popped in my head this morning, months after i last touched that code, what if i create an empty project with just shy of 1500 nameless, parentless groups? When i export i open that project, i pick an empty group, place my entities and rename the groups, but then i have to create this tree structure, where some groups own other groups. For example a wall group owning a window group owning a left frame, right frame , glass and etc. groups. This structure varies a lot. I see there is the possibility to move groups inside of the Outliner, but how can i do this in code?
ThanksEdit: Is it me, or have they sped up the process? I could swear a couple of versions ago this would take a minute or so:
def add_groups model = Sketchup.active_model ents = model.active_entities for i in 0..1500 ents.add_group end end
-
RE: Fullings Mill
Something just doesn't feel right about that mini-waterfall. My 3D senses are tingling.
Other than that, beautiful work, love it. -
RE: Add_group slow on mac
I would have loved it if they fixed add_face too. I've found workarounds, so i don't need it now, but still.
-
RE: Why is my Group deleted while trying to add entities to it?
Also, even if you don't use it, group.entities.add_faces_from_mesh and group.entities.fill_from_mesh seem to delete everything existent in that group.
Edit: thomthom corrected me, sorry. Also, i wrote group.fill_from_mesh instead of group.ENTITIES.fill_from_mesh.
I'm going to crawl back to my hole now, one post, two mistakes is quite embarrassing. -
RE: Writing custom aditional data in .skp
Well that was easier than expected. Thanks!
-
Writing custom aditional data in .skp
Hi again.
I was wondering if there is anyway we can add additional data (text is sufficient) to a skp file. Data which cannot be accessed by end users, only devs who know where to look. I could use the description parameter, but that can be changed by a user. -
Intersect_with question/problem
So after another long deliberation i chose to use the add_faces_from_mesh or fill_from_mesh for that export i keep blabbering about. Sadly this creates a few problems, one of which is that i can't position textures directly, i have to go through the whole newly created faces list and position the texture on each of them. For that i have to keep track of the order in which the faces are added, cause there is no way to associate the polygon created for the mesh object with the face object generated when i create the mesh, except to remember the order in which they were created.
The second problem i have, and the one i have questions about is cutting a hole. Seems easy, doesn't it? Well the mesh object google provides doesn't allow us to specify the "inner loops", unlike the unsupported C++ SDK. One option would be to use the usual add_face method, folled by add_face + erase for the holes. That slows down the export, so i have to try and find a different way. One way would be to add the faces from the mesh and then delete the holes. Thing is, if i add 2 polygons, let's say 2 squares, one smaller, inside the other one, no common points, when i create the mesh the two faces created overlap, but do not intersect, so deleting the smaller one makes no difference. Here i get to the intersect_with problem. I can't get it to work. Since i can't post from work (our ISP's IPs are all banned for some reason) i'll try and write the code from memory.model = Sketchup.active_model entities = model.active_entities pt1 = Geom;;Point3d.new 0,0,0 pt2 = Geom;;Point3d.new 10,0,0 pt3 = Geom;;Point3d.new 10,10,0 pt4 = Geom;;Point3d.new 0,10,0 pt5 = Geom;;Point3d.new 1,1,0 pt6 = Geom;;Point3d.new 9,1,0 pt7 = Geom;;Point3d.new 9,9,0 pt8 = Geom;;Point3d.new 1,9,0 mesh = Geom;;PolygonMesh.new mesh.add_polygon pt1,pt2,pt3,pt4 mesh.add_polygon pt5,pt6,pt7,pt8 group = entities.add_group group.entities.add_faces_from_mesh mesh,0 #now i have to try and intersect the faces, actually i have to #intersect the 4 lines that make up the smaller square with the #face that is the larger square transformation = group.transform! #i forgot the exclamation #point at work....hmmmm #now if i provide the last parameter as an array of entities i #extract from group.entities, it crashes if i provide one or more #line objects in the list. if i only provide face object it #doesn't crash, but doesn't do anything either entityArray = Array.new entityArray.push group.entities[i] #with i i can select the lines 0-3,5-8 or the faces 4,9, i won't write that code entities.intersect_with true, transformation, group.entities, transformation, true, entityArray
What am i doing wrong?
-
RE: Add_group slow on mac
I've had the same problem. I wrote an import tool for a custom format, and add_group (if i create a group for each volume) or add_face/add_point(if i create just one main group, and keep adding to that) greatly slows down the import. It gets exponentially slower (1.2 secs for 100 volumes, 120 seconds for 1400, 0.02 secods/add_group in the beginning, ~0.2 seconds/add_group near the end). I tested this with the GWD's code, and even without all my other code, it is just as slow. Any ideas/ workarounds? I work on windows vista (not my fault ).
-
How to remotely start sketchup
Hello.
I need to remotely (externally, same computer) start sketchup and start running a script.....how can i do that?
I guesssfile = "application_loader" # .rb or .rbs not required statuts = Sketchup.load(sfile)
is okay for running the script, but how do i start sketchup and access the console?
Something like: "C:\Program Files\Google\Google SketchUp 8\SketchUp.exe -console -the commands i have been talking about"?
Thanks -
How do i add checkboxes?
Back again with another problem.
What's the code for adding a checkbox to a dialog box? I've searched everywhere. I want to redo the "Show/Hide Layers" with and auto-update option(not sure about this one yet). BTW is OnChange available in ruby/sketchup? More importantly i want to organize the layers differently(not in the order of creation, two columns(left/right side of house), yada-yada-yada). I can handle that, but i can't do anything without checkboxes, cause drop down menus would be quite a compromise.
Thanks -
RE: Ruby console units
Thank you Chris.
Well since it's in inches i'm going to have to use the .mm type of commands. I don't care/need to know what template the user uses, it's just operations would have been simpler. -
Ruby console units
Hi!
I'm sure this is a newbie question, probably asked many times before, but i searched for it on the forum and i couldn't find it.
I'm very new to ruby (less than a week) and i have some experience with sketch-up(hobby, designing furniture for my new apartment).
So here goes nothing. What unit does sketch-up use internally? For example, if i use the line = entities.add_line point1,point2 command, the coordinates for the points are considered inches, even with my template set to cm.
It's not a big deal, but i plan to write an export to sketchup tool(more like an import to sketchup plugin) for the company's software(it uses the metric system). Do i have to use the numeric.cm & co commands or can i just set the unit to whatever i want?
Thanks