TIG,
Thanx for your answer, it completely elucidates my question.
TIG,
Thanx for your answer, it completely elucidates my question.
Hello,
I was wandering how to draw a point on a face like this?
My strategy would be:
1: Find outer_loop.vertices for the face.
2: Use outer_loop.vertices[0] as a starting-point to place the desired point by trial and error, while using the classify_point method for the face.
The problem of this method is that near the vertices there could be holes of
which the script is not aware.
Best regards,
Liquid
Thanks guys. It seems this is a PC only bug. So far no reason to buy a mac..
Hi,
I have a string = "t\tt"
In console it prints:
t t
But ents.add_text string, [0,0,0]
Gives 'tt'
why??
Is there a magic workaround whose existence I'm not aware ?
Thnx guys!!
Liquid
It WILL be difficult, but I'll try next year...
Thanx guys,
I use a thumbnail viewer (explorer extension) to preview skp files in windows explorer.
One can write a plugin for the viewer to expand its functionality for different filetypes (like dwg and dxf).
I already found the dxf-file-specs, it says something about THUMBNAILIMAGE section. But I can't get hold of a dxf file with such a keyword.. (probably because it's impossible
as Dan explains.)
@TIG Please: no fame for me!!!!
At this moment its to complicated to write for me. But maybe in the future.
What functionality would you expect, better than the PRO version?
Best wishes for 2013!
Liquid
Hello fellow nerds and nerdettes,
I'm interested in expanding SU's capability of exporting dxf/dwg files.
Along which lines should I think in order to generate such a file, including
an embedded image (for previewing purposes in windows explorer ), just like SU's native 'skp' formats?
Best regards,
Liquid
Hello guys,
This script gives you all real world coordinates of vertices in ((deeply)-nested)entities in the active model.
The script is largely based on a script named 'SketchUp to DXF STL Converter'. For more details please see the attachment.
It's brute force, so I'm curious for more elegant solutions....
Liquid
Gentlemen,
Thanks! I wrote my code indeed along the lines TIG wrote..
edit:
Thomthom ok I'll do that!, thnx
Glenn, Thnx!
This script was really helpful to me and instructive too!
@dan rathbun said:
So it is much more efficient to iterate the model's
DefinitionList
collection, and access the instances through a definitionsinstances
collection.
ah... that makes sense!
@dan rathbun said:
It is their definition that has the entities collection. (The group.entities() method is a shortcut that often deceives novices into thinking that the group instance has entities. It actually is a wrapper method for group.parent.entities )
I'll remember that one , thank you!
Liquid
Extra :
@model.definitions.each { |d|
if d.group?
puts d.instances[0].class #==> Sketchup;;Group
end
}
Lets say I've got a model full of nested groups/components.
And I want to find all faces with a particular property in that model .
What is a good solution to this problem?
I tried:
entities.each { |ent|
if ent.is_a? Sketchup;;ComponentInstance or ent.is_a? Sketchup;;Group
#group
ent.entities.each { |ent|
if ent.is_a? Sketchup;;ComponentInstance or ent.is_a? Sketchup;;Group
#nested group
ent.entities.each { |ent|
if
..
end
}
end
}
end
}
But I don't know how deep I have to dig!!
Other solution I was thinking of: keep exploding everything until everything is free, then get my faces, undo the exploding part
and move on..
Any ideas are appreciated,
thnx liquid
Off topic:
@unknownuser said:
(1) The word useful has only 1 "L", by the way.
thanx for your correction, the English language is not my mother language as you might have noticed..
/Off topic
All code is safe now and my code works like a charm, so thanx for your help. And yes I SHALL read the book before
I come here and ask questions like this..
@dan rathbun said:
@liquid98 said:
By the way I found that calling :
require("liquid/useful.rb")
> > include(Liquid;;Useful)
only works outside the module definition..
NO.. This is not true, .. and Do not do this. If you do, you will add methods to EVERYONE's modules and classes, not just yours.
If you cannot get it to work, then you are doing something incorrect.
FYI: The mixin methods, in a mixin module, must be defined as instance methods, without a
self.
before the name.
Hi Dan,
I just copy pasted your example into two files:
It works only if
require("useful.rb")
include(Liquid;;Useful)
is outside the modules.
Can you please take a look??
Thnx,
Rene
Dan,
No I haven't read the book yet. Though I scraped my information from several places, like this forum, google, other books, Rubydocs
'Automatic Sketchup', etc.
In my point of view 90% of ruby scripting for sketchup is just using the Ruby API. The other 10 % is a set of rules cq best practices
to manage the code in a efficient way.
Though I thank you for your suggestion, I have I complete folder of URL's with ruby books, to impressive to start with..
So a good starting point is welcome.
Rene
Hi Dan,
Thnx for the information. The next script I've written will have this namespace treatment!
By the way I found that calling :
require("liquid/useful.rb")
include(Liquid;;Useful)
only works outside the module definition..
edit: Other question: Is there some evil in using load
instead of require
?
Thanx again Dan,
Really beautiful to see it running this way!!
This trick is not widely known according to my grep..
Liquid