Storing Geometry
-
Has anyone stored small amounts of sketchup data to disk files (not skp).
I would like to add to door maker the notion of user definable door pulls (handles) and then store these items into a folder. The name of the file will become the entry in the drop down list.
Alternatively is there a way to store a handle in a skp file like the warehouse and then through code automatically fetch it and insert it into the drawing.
-
Why not save the component to disk as SKP? Then load it as a component again?
Making your own file format - or even using another existing format - seems like extra work for no gain. -
I've got this working now however there is one thing I'm wondering about.
If I add 3 doors that use the same door handle, each within their own commit.
I undo once and the last door disappears. I undo a second time and the same thing happens.
So far so good!.But then I need to undo several times to remove the first door. It appears that loading the handle component within the start_operation / commit sequence breaks the sequence but just for the door where we go to disk. As long as the definition is already in the model then it behaves as expected.
-
YES, in answer to the skp question, as to both local component library, and 3DW skp file.
DefintionList#load()
DefintionList#load_from_url()A component saved as a skp, can have options saved into the
"dynamic_attributes"attribute dictionary.
Have you played around with any of the components in the Sample library ?EDIT: corrected name of dictionary
-
It seems wrong but it appears to work better if I load the component definition outside of the start_operation / commit operation. Anyway - I will continue doing it this way until someone comes up with another idea to try.
-
@garry k said:
It seems wrong but it appears to work better if I load the component definition outside of the start_operation / commit operation. Anyway - I will continue doing it this way until someone comes up with another idea to try.
Well I was going to suggest this anyway, but with the addition that the definition load gets it's own operation named "Load Component: 'Handle'". (But then SketchUp actually creates an operation for it anyway with the generic name "Load Component".)
-
What version of SketchUp are you testing on? In SU2014 we fixed this:
@unknownuser said:
Fixed DefinitionList.load and load_from_url which did not start Ruby operations properly.
They completely mess up the undo stack unfortunately on older SketchUp versions.
http://www.sketchup.com/intl/en/developer/docs/releases -
Thankyou - this will be a good read!
I currently test on SU 7, SU 8, SU 2013 and SU 2014. The work around is easy enough.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement