The exploding/shell/replacement thing is interesting, but not what I have in mind - also, not really dealing with the question, which is why is the file so large to begin with. I've done far more complex drawings in AutoCAD and other apps, and the file size is nothing close to this. Just doesn't make a whole lot of sense.
I guess the answer is "it is what it is"...
Posts
-
RE: Dynamic Component Instances and File Size?
-
RE: Dynamic Component Instances and File Size?
@kaas said:
Ok, in this file there are 243 component definitions and they all contain the same 4 sub-components. Is it possible for your workflow to use a group as a top-container instead of a component? If I do that, the file is only 106kb.
Well... I'm not sure how that would work, for a couple reasons... 1) I have to do reporting on the components, which in the case of the component in the example file can be anywhere from 1" to 66' long, and the geometry of the sub-components needs to be correct... and that one example component can be up to 20 different products each with different geometry so the component needs to be flexible. 2) I need to be able to easily edit, audit, and track them later, repeatedly.
So, my real question I guess is this: if the geometry is not the problem, then what about the dynamic component is making the file so huge? Is there some way to do them to avoid the bloat, certain functions on properties that cause the problem, or what? I don't understand how/why a few properties placed on an object can make it grow in data size so drastically.
-
RE: Dynamic Component Instances and File Size?
@kaas said:
could you post the skp of one component so people could test with the actual thing?
I just tested copying a 100kb component 1000 times -> file size went up from 100kb to 242kb.
Copied those 1000 components again 30 times so in total 30.000 components -> file size was 4Mb.
Applied a random rotation and scale to every component -> file size was the same as before.Maybe it's some attributes or dynamic component behavior that's causing this? Posting a sample component file would help determining the problem.
It has to be something related to the dynamic components, yes, I just don't know what.
I have attached an example - this skp has 240 instances of one of the components, which is the maximum I could fit into the file before it exceeded the 4 MB file size restriction on attachments here.
The component that's been inserted by Ruby is only 37 KB as it's own file.
Each time, the code is figuring out the position, length, and rotation needed, adding an instance of the component, setting some various dynamic properties, and then redrawing the component.
-
RE: Dynamic Component Instances and File Size?
@pcmoor said:
my suggestion is to destroy the collection of components after collecting the data and creating a new one containing raw geometry (the exploded DCs) then purging the drawing of these 100 or so DCs, Perhaps before such an event the group of DCs could be saved to a separate file so the newly formed group component can be swapped for editing if required
Unfortunately, that won't work - I have to be able to go back into the file later and edit the floor layout and products for structural plan revisions and the like, so it can be quoted 1-3 times, then submitted to building departments 1-3 times, etc, and revised over and over, and the data retrieved over and over likewise. If I explode the components, I lose most of the data and capabilities I need to retain. I could like you say put them in another file, but then I have two files instead of one, and the 2nd file is still huge, so no space is saved (actually losing space since I have two files).
-
RE: Dynamic Component Instances and File Size?
@pcmoor said:
using Ruby on a selection you could collect or group a number of components, read, count the data, then explode the inner components to form a new group component, purging as you continue
I'm not sure I fully understand what you're saying there... though, along those lines, I've noticed this: I'll have one building level complete, might have say 2000 components. I have a tool created to copy and move selected objects - it groups everything selected, translates the location, then explodes the group. At least as far as the file size is concerned, these new copies are effectively the same as the originals (very little file size change). BUT, when I change even one property on these copied components - even something simple and not referenced by other properties, like a changing an object's floor name from '2nd Floor' to '3rd Floor' - then the copied component upon redraw is broken out by SU into it's own unique component... so if I do this on all those objects from one floor, suddenly the number of unique components in the model doubles. It's just frustrating. So much more could be done with SU if there was a way around this.
-
RE: Dynamic Component Instances and File Size?
I'd post examples, but the SKP files are gigantic, and my plugin code is just shy of 200,000 characters altogether.
-
Dynamic Component Instances and File Size?
Hi all,
So... I've got this custom plugin (kind of a suite of tools, I guess) that I've written at work. Basically, I'm using SketchUp as a combination estimating/layout tool for Engineered Wood Products (EWP).
I have to say, this tool is pretty amazing, thanks only to extensive tutorials and shared information on sites like Sketchucation... the countless things I've learned from this community in helping me learn Ruby and the SketchUp API are invaluable.
That being said, their are a couple things that I'm wondering if there is any at all to do about. The biggest one is file size.
Now, I know there's probably nothing to be done, but just the same, I have to ask. In my layouts, I'm working on buildings which can be tens of thousands of square feet per floor. On one floor, by the time I'm done laying out the floor system, I will likely have thousands of components in the file. I have a base set of only 6 dynamic components which are placed, rotated, scaled, etc to create the layout components and thus the material list.
I can totally understand that the more components there are, the bigger the file, the more RAM required, etc. However, it seems that with SketchUp, the file size seems to increase exponentially... so for a while everything is fine, but at a certain point the file grows more for adding, say, 100 components than it did for the previous 100, and the 100 previous, etc (as does the slow-down and hour-glassing waiting for SketchUp to catch up). Most projects I work on end up being around 200 MB files, which doesn't seem right to me... I thought that part of the reason to use dynamic components was to reduce needed data/file size, but the inverse seems to become true at some point.
I even toyed around with making a '2D-only' version of my components - thus flattening the layout and reducing the geometry vastly - but this seemed to have little effect on the file size, leading me to believe that most of the file size was coming from the overhead of the simple fact that they are dynamic components... am I wrong on this? Something about this doesn't seem to jive in my gut.
From my understanding, even though I'm using the same base component, since each one is positioned and scaled and such, SU makes each one unique... which I think is the problem. But, I have no way to stop that from happening, so... I think I'm out of luck? -
RE: Ruby Plugin - Inserted Component Wrong Scale
TIG, you rock. Thanks for the help (including all the other countless posts of yours I've read on other threads that have taught me so much so far). I think that got it after having it load once (with the exception of one situation where I need it to load separately each time - I have a 'container' component that other sub-components get inserted into, and if it's not reloaded, then the previous sub-component instances are in the new container instance as well, which I don't want). I also changed the path \, and float, and yes 0 length is getting trapped.
I still have so much to learn... -
RE: Ruby Plugin - Inserted Component Wrong Scale
It's quite bizarre. Odd thing is, if I draw one of the components at a 1:1 scale first (12" long), then continue to insert more, it seems to hold the proper scale for the other instances. If the first one I draw is not at a 1:1 scale, then the subsequent instances are scaled off of the new scale of the first one (ie, if the first one drawn is say 24" long, then 24" becomes 1.0... so then when I draw a 12" instance afterward, it's at 1.0 scale, which then is drawn as 24" even though the points I picked are 12" apart. I don't entirely understand this... it's reloading the component from file every time, but I guess it still links them together...
-
Ruby Plugin - Inserted Component Wrong Scale
Okay... I've learned a ton about SketchUp and Ruby recently, but this problem has me totally stumped. I'm white-flaggin' it.
So, here's the situation:
I have some code in my plugin running which inserts a component from a SKP file after the user has clicked two points (p1 and p2). After setting the z coordinate to the same on each point, the length is measured between those two points on a horizontal plane. I have my SKP component stored as exactly 1' long on the Y axis (it needs to grow/shrink to length along the Y). The component is inserted where it needs to go, then scaled along the Y axis (among other things). The length divided by 12 is therefore my new scale I want the component to have:newcomp_def = model.definitions.load("C;\test.skp") trans1 = Geom;;Transformation.new p1 trans2 = Geom;;Transformation.scaling p1, 1, (length/12), 1 instance = entities.add_instance newcomp_def, trans1 instance.transform! trans2
This works perfectly over and over... but as I go along drawing in the same file, at some point the component starts to end up the wrong length. It's as if the definition itself has gotten rescaled so that the scale is no longer 1.0 compared to the original. I have confirmed this by remarking out the line that rescales the component (essentially leaving it at original file scale, which should be 12" long), then drawing, and the "1.0" scale component is LONGER than 12". I have even tested by switching the SKP file that is loaded to another that is the same 12" length, and it works perfectly. Also, if I start a new drawing from template, it works perfectly as well. But when I go back into a drawing where the length is incorrect, it once again is the wrong length. This leads me to believe that somewhere SketchUp has the scale for the definition with this specific file wrong... but how do I fix it or purge it? I've tried everything I know to do and none of it has had any effect.
Thanks in advance!
Placid
-
RE: Ruby Component Insertion and Attributes - Not Updating
Perfect! Got it going. Thanks!
-
Ruby Component Insertion and Attributes - Not Updating
Hi all,
I hope this is the right forum to post this in.
I am pretty new to making my own Ruby scripts, so I'm not sure how to do this.
I have some dynamic components I have made, and exported them out of the model as their own .skp files. I want my script to get two points from the user, then load and insert the component at the point specified by the first click, scale it along one axis, then rotate it into position so the second end is at the point specified by the second click. There is also I prompt for the user to set certain values, which are then applied to attributes on the component, as well as the geometry changed.
I have everything working more or less perfectly, with one exception: While the attributes are set on the component, the geometry and textures are not updated on the model until I either edit the components properties manually, or scale it manually.
How would I go about having Ruby update the appearance of the component after all the attributes are changed?
Here's a truncated version/snippet of what I have:#load the file newcomp_def = Sketchup.active_model.definitions.load("Q;\Test.skp") #create insertion transform trans1 = Geom;;Transformation.new p1 #transform scale along y to correct size trans2 = Geom;;Transformation.scaling p1, 1, (length/12), 1 #move the box over since in my model it's centered and I want it on edge scootvec = Geom;;Vector3d.new (width/2),0,0 #create transform from vector trans3 = Geom;;Transformation.translation scootvec entities = Sketchup.active_model.active_entities #insert component at point 1 instance = entities.add_instance newcomp_def, trans1 #scale it to length instance.transform! trans2 #move it over by half instance.transform! trans3 #rotate it to the correct angle instance.transform! transrot #set attributes instance.set_attribute("dynamic_attributes", "product", "Name") instance.set_attribute("dynamic_attributes", "width", width) instance.set_attribute("dynamic_attributes", "depth", depth)
I have formulas on the component to set the textures, x and z dimension, etc. I have confirmed the values are changed by going into the component editor, the appearance just doesn't change/isn't updated.
Is it simple to accomplish this?Thanks!
PlacidFury
-
RE: [Plugin] Auto Centerpoint
Thanks! This will rock... I've done so many models with curves lately, and having this autocenterpoint script will sooooooo simplify my work. You rock!
-
RE: [Plugin] Auto Centerpoint
I guess that's the problem, because the zip file I downloaded (both times) has no singleton.rb file or a ruby subdirectory... the other files are there, and properly in their subdirs... but that one is missing altogether... do you see it when you open it?
-
RE: Display Edges kills performance
I've got the latest drivers considered stable with my hardware and OS...
I changed the fast feedback setting, at it helped immensely... it's at least usable now! Thanks! -
Display Edges kills performance
Hey all,
I just upgraded my video card, and while everything in general, and specifically SU, runs much faster, I have a (what seems to me) strange issue: if I have display edges on in SU, my performance goes in the tank. It kills things faster than textures do. Any ideas on what might be the issue or what might help? It is a large model, but even so, the edge lines have never been an issue on the other two machines I've run this on...It's a Sapphire ATI card, and SU 6, if it matters. Sorry if this isn't the right forum to post this...
Thanks in advance,
Placid Fury
-
RE: [Plugin] Auto Centerpoint
I'm getting the ruby/singleton error as well... have re-downloaded, dir structure is there... any ideas? Thanks!