We have a similar function.
The material is on a face. We use tw.write to ave the raster image to a temporary file, and then use the image to create a new material.
We have a similar function.
The material is on a face. We use tw.write to ave the raster image to a temporary file, and then use the image to create a new material.
Did you call tw.write(entity, fname)
If you examine the .SKM file, you will discover that it is a zip file with the material stored in it. So if you have a way to read the zip file from Ruby, you can access it.
Another way we get the texture is to assign the material to a face or image and use TextureWriter to write the textures to a file. (If it is a "distorted" texture, it will not write the original texture, but rather the texture as it appears on the face.)
Try adding these 3 lines to the Langhandler.rb code.
(The last 3 on the left)
#pull out the key
keyvalue = entryString.split("\"=\"")
$keyvalue = keyvalue
$entryString = entryString
printf("'%s' '%s' '%s'\n", entryString, keyvalue[0], keyvalue[1])
This will print out how it splits the entryString.
and the two $variables let you examine whatever the last values were when it failed.
It turns out that it fails on the line: "-- Runtime --" = "-- Durée d'exécution --";
and the reason it fails, it because it is looking for: "=", and this line has: " = "
(spaces around the equals signs.)
Yes.
@tig said:
Or put another way - you want a method something like:
ComponentDefinition.export
or
ComponentDefinition.save_as
...
On a similar note, I thought there was a way to create an SKP file, using the SDK from
outside of SketchUp. I even thought we had tried it once.
But today I can't find it.
Does anyone know if it is possible to create an SKP file in a stand
alone program using the SDK.
(We regularly do this by creating a .rb file and then reading it, but
we would like to create a .SKP file directly.)
No Todd,
I want to create a SketchUp Component (say a furniture item), while the user is working on a larger layout, and then save the new component if a library so the next time the user needs it I don't have to create it again.
We did find the SDK code which lets you write a .SKP file directly, and then load it as a component, so we will try that route.
How to create and save a component in an active SketchUp model.
I would like to create a component with a Ruby file, (which I am able to do), and then save just the component definition to disk (which I don't know how to do).
I'm sure I have asked this before, but I can't find a record of it on the SUC Forum.
Any ideas? (And I don't want the user to have to save it by hand)
Also, some "search engines" aggregate content by trying to provide a better way to serach it and find it, and, of course, perhaps adding their own advertising to the search pages instead of the Google Ads which you have to suspect will appear someday.
There is a new, free, product called eZ which lets you import SketchUp models and share them with your clients - either by emailing them an eZ file, or by using them in an interactive Net meeting format (eZ-meeting is not free).
eZ-meetings "claim to fame" is that it operates a CAD net-meeting, where all participants can spin, pan and zoom on 3D models, as well as marking-up (arrows, notes, etc.) all documents being observed.
eZ-meeting exports to documents themselves to the participants machines, which makes it easier to pan, zoom, and spin the documents then in a traditional net-meeting format - which has to transmit raster images each time the screen changes.
Take a look at: http://ezmeeting.com/
eZ-meeting imports SketchUp models, as well as many other formats such as DWG, PDF, DOC, etc.
Unless this process is still on-going, it might be time to "unstick" this thread so we can find the rest of the threads more easily. 
(I think that was the thread I was thinking of...)
It doesn't qualify as a Ruby script because it depends on two pre-made components - one for horizontal dimensioning and one for vertical (you could rotate for the vertical, but I chose to place the vertical dimensioning outside the lines.)
Also, the .rb files assume another routine to locate components. ($component_folder)
But I will share the code if any other ruby developers want to use it.
def hdim(ploc, len)
model = Sketchup.active_model
entities = model.active_entities
sname = "CS_hdim-240"
clen = 240 # size of component in inches
# see if we have already loaded the component
definition = model.definitions[sname]
if (definition == nil)
skp_name = sprintf("%s\\%s.skp",$component_folder,sname)
definition = model.definitions.load(skp_name)
end#def
instance = entities.add_instance(definition, ploc)
transformation = Geom;;Transformation.scaling(ploc, len/clen, 1, 1)
instance.transform!(transformation)
end#def
def vdim(ploc, len)
model = Sketchup.active_model
entities = model.active_entities
sname = "CS_vdim-240"
clen = 240 # size of component in inches
# see if we have already loaded the component
definition = model.definitions[sname]
if (definition == nil)
skp_name = sprintf("%s\\%s.skp",$component_folder,sname)
definition = model.definitions.load(skp_name)
end#def
instance = entities.add_instance(definition, ploc)
transformation = Geom;;Transformation.scaling(ploc, 1, len/clen, 1)
instance.transform!(transformation)
end#def
Let me know if you want to components as well. They both have the dimension lines pointing to 0,0.
For metric all the user has to do is change the drawing units.

To change the font size, or the arrow you have to alter the original base dimension component
I could swear I found this idea as part of another thread, but now I can't find it.
The idea was to add dimensions to a model in Ruby by creating a component with a dimension in it and scaling it into place.
The query in the "ghost" thread, was worrying about whether the arrows and leader lines would transform as well, and therefore you might need a few base dimension components so you wouldn't have to scale them too much.
After some testing, and using a transform in the X-axis only:
transformation = Geom;;Transformation.scaling(ploc, len/clen, 1, 1)
(clen was then length of the dimension in the component)
I found that I only needed one base component.
This worked pretty well:

(All the dimensions were added with a ruby routine. Ignore the yellow text in the middle)
(Click on Model for larger size)
Model from the 3D Warehouse rendered with nXt Studio lighting.
(I added a little reflection, but no sun or lights)
Studio lighting provides a good 3D effect for Exterior models.
(SketchUp in the upper left, nXt in the lower right)
This one zooms in much better and doesn't clip the 20' 

@alpro said:
Using Anssis suggestion produced a much better result.
Mike
Thanks,
The PDF you sent is pretty good quality, but it is "rasterized" and not a vector drawing.
You can see this because when you Zoom in the lines are jagged.

This is the PDF from SketchUp, zoomed in in Adobe. When you zoom the vectors are redrawn and don't get jaggy.

Still, it may be of good enough quality to work.
Another interesting thing is that the PDF you created to chopped off some of the text.
The Image on the top is from the PDF. The 20' is missing the bottom half of the text.
The image on the bottom is the SketchUp screen.
@alpro said:
Al, here you go.
Mike
Actually, its the other way around.
I went to a meeting last week to present to a bunch of potential users. But it turned out that 80% of the were Mac users, and IRender only works on the PC 
@unknownuser said:
@al hart said:
IRender.
i thought for sure when i first heard of irender that it would work with macs.. possibly a mac only app..
[random, useless comment of the day
]
Hmmm...
Interesting that my Firefox ad blocker does not block ads on the Custom search page.
Maybe Google has found a way to beat the ad blocker?
I hadn't thought about an external PDF.
Does it create the PDF from vectors or a raster image?
Can you upload the PDF so I can check the quality?
Thanks