e is most likely valid. When e does not have a material assigned, the .material method returns nil.
Todd
e is most likely valid. When e does not have a material assigned, the .material method returns nil.
Todd
results, as returned from inputbox, is an array.
Todd
@rickw said:
Now, for the follow-up challenge:
Create the jukebox with less than 100 characters! Entries due by noon (GMT-6) on Monday, 6 August 2007. Short challenge, but the hard work's been done
Here's mine:
iTunes
What do I win?
Well, count me out. Didn't get to it. Next time!
Todd
@ilay7k said:
Todd i got it using WinHTTrack/in chm-format
and samples too
Thanks! Will do it now.
Todd
Is there a PDF available with the V6 Ruby Help topics? I got the SketchUp V6 users guide on PDF. Wondering if there is one for Ruby Help.
Thanks, Todd
There are all the options accessible from Ruby (unless I missed some). I don't see autosave anywhere.
UnitsOptions
LengthPrecision=4
LengthFormat=3
LengthUnit=0
LengthSnapEnabled=true
LengthSnapLength=0.0625
AnglePrecision=1
AngleSnapEnabled=true
SnapAngle=15.0
SuppressUnitsDisplay=false
ForceInchDisplay=false
PrintOptions
PrintWidth=8.5
PrintHeight=11.0
ComputeSizeFromScale=false
SizeInPrint=1.0
SizeInModel=1.0
VectorMode=false
FitToPage=true
NumberOfPages=1
LineWeight=0.5
PixelsPerInch=150.0
SectionSlice=false
ModelExtents=true
PrintQuality=0
ScaleAdjustment=1.0
QualityAdjustment=1.0
PageOptions
ShowTransition=true
TransitionTime=2.0
SlideshowOptions
LoopSlideshow=true
SlideTime=1.0
NamedOptions
LengthPrecision=4
LengthFormat=3
LengthUnit=0
LengthSnapEnabled=true
LengthSnapLength=0.0625
AnglePrecision=1
AngleSnapEnabled=true
SnapAngle=15.0
SuppressUnitsDisplay=false
ForceInchDisplay=false
PrintWidth=8.5
PrintHeight=11.0
ComputeSizeFromScale=false
SizeInPrint=1.0
SizeInModel=1.0
VectorMode=false
FitToPage=true
NumberOfPages=1
LineWeight=0.5
PixelsPerInch=150.0
SectionSlice=false
ModelExtents=true
PrintQuality=0
ScaleAdjustment=1.0
QualityAdjustment=1.0
ShowTransition=true
TransitionTime=2.0
LoopSlideshow=true
SlideTime=1.0
BackgroundColor=Color(255, 255, 255, 255)
BandColor=Color( 0, 0, 0, 127)
ConstructionColor=Color( 0, 0, 0, 255)
DepthQueWidth=4
DisplayColorByLayer=false
DisplayFog=false
DisplayInstanceAxes=false
DisplayWatermarks=true
DrawDepthQue=false
DrawGround=false
DrawHidden=false
DrawHorizon=true
DrawLineEnds=false
DrawProfilesOnly=false
DrawSilhouettes=true
DrawUnderground=true
EdgeColorMode=1
EdgeDisplayMode=1
EdgeType=0
ExtendLines=false
FaceBackColor=Color(171, 176, 204, 255)
FaceColorMode=0
FaceFrontColor=Color(255, 255, 255, 255)
FogColor=Color(255, 255, 255, 255)
FogEndDist=-1.0
FogStartDist=-1.0
FogUseBkColor=true
ForegroundColor=Color( 0, 0, 0, 255)
GroundColor=Color(210, 208, 185, 255)
GroundTransparency=50
HideConstructionGeometry=false
HighlightColor=Color( 0, 1, 255, 255)
HorizonColor=Color( 0, 0, 0, 0)
InactiveHidden=false
InstanceHidden=false
JitterEdges=false
LineEndWidth=9
LineExtension=3
LockedColor=Color(255, 0, 0, 255)
MaterialTransparency=true
ModelTransparency=false
RenderMode=2
SectionActiveColor=Color(255, 135, 0, 255)
SectionCutWidth=3
SectionDefaultCutColor=Color( 0, 0, 0, 255)
SectionInactiveColor=Color(112, 105, 97, 255)
ShowViewName=true
SilhouetteWidth=3
SkyColor=Color(189, 209, 208, 255)
Texture=true
TransparencySort=0
Todd
@tomot said:
model.entities.add_arc([x+@dist, y+@dist, z], vecx, vecz, @d/2, 0, pi/2, @s)
model.entities.add_line([x+@dist, y+@dist, z],[x+@dist, y+@dist+@d/2, z])
e=model.entities.add_line([x+@dist, y+@dist, z],[x+@dist+@d/2, y+@dist, z])
e.find_faces
e.faces.first.pushpull @thickdo I understand the following correctly?
"e",collects the 3 entities (arc, line & line)
"e.find_faces" ,then makes the face out of the entities
now what does "first" do because without it pushpull still wont work?
tia
You are right - I misread. No, you don't understand correctly. But you will soon enough.
@unknownuser said:
"e",collects the 3 entities (arc, line & line)
No. This assignment to "e" only assigns that last line (edge). You only need to .find_faces on a single edge for a closed loop of lines in order to get a face. So, your assignment is correct. You could have performed the .find_faces on the other line, or, any segment of the arc, and you would get the face like you want.
@unknownuser said:
"e.find_faces" ,then makes the face out of the entities
Basically, yes. The method looks at the edge you pass, then goes through all edges connected to the edge you passed, and for every closed and coplanar loop of edges that can be found, faces get made.
@unknownuser said:
now what does "first" do because without it pushpull still wont work?
The .first method will pass the first array element to pushpull. Your code is:
@unknownuser said:
e.faces.first.pushpull @thick
e is an edge.
e.faces is an array of all the faces that use this edge.
e.faces.first is the first element (the first face) in the faces array.
e.faces.first.pushpull calls the pushpull method for the passed face. (e.faces.first).
See the doc here: http://www.ruby-doc.org/docs/ProgrammingRuby/ for the Array class and its methods.
The .pushpull method is defined to be called for a face, not for an array. When you use the .first method on the faces array, you are picking a random face (the first one in the array at position face[0]), and it will pushpull just fine. Note that you are doing nothing in your code to identify the exact face you want to pushpull - you're just picking, essentially, a random face. So, yes, the pushpull works, but no, it's probably not acting on the face you want. If it is acting on the face you want, they you are a lucky person, because of all the newly created faces, the one you wanted jut happened to be the first one in the array.
Todd
That won't work. I don't have time now to respond, but will later tonight.
I've posted the code to do this somewhere before. Perhaps in the old pro Ruby forum. Maybe you can search on "find_faces" and "pushpull" to locate it.
Todd
The code you have won't work.
"e" is an edge. e.find_faces works for edges, so it's good.
e.pushpull will never work, 'cuz .pushpull only works on faces.
Remove the e.pushpull, do what I said in the first post to come up the new face, and then do the pushpull on that face.
Todd
Before the .find_faces, do an inventory of all the faces in your current entities set.
After the .find_faces, do a second inventory of all the faces in your current entites set.
Subtract the first inventory from the second.
With the remaining elements, find the face with the same normal as the one you pushpulled.
Todd
Welcome a-tom-b, atom-bomb, a Tom B, Tom!
Todd Burch
Todd B.
toddb
atoddb
Oops.
Command = 1048576
Alt = 524288
Control = 262144
The Command key, also known as the "apple" key, shown as a β in the Doc, is the Mac equivalent to the PC's CONTROL key. The control key on a Mac isn't used that often.
The ALT key is also named the Option key.
Todd
Ignore any logic you see - this is from an old copy of a script. They keycodes are good though, for both Panther and Tiger, and I suspect they will be the same for Leopard too.
BTW, in OS X "Tiger" 10.4.10, the RUBY_PLATFORM constant is "fat-darwin8.8.0". If you check for "darwin" that should be good enough, thru Tiger anyways.
Todd
if !defined? KNUDGEOK then
if RUBY_PLATFORM == "i386-mswin32" then # Win XP
KALXMINUS = 37 # Arrow Left Key
KARXPLUS = 39 # Arrow Right Key
KAUYPLUS = 38 # Arrow Up Key
KADYMINUS = 40 # Arrow Down Key
KLTZDOWN = 188 # (comma) Less Than Key
KGTZUP = 190 # (period) Greater Than Key
KSHIFT = 16 # Shift Key
KCONTROL = 17 # Control Key
KNUDGEOK = true ;
elsif RUBY_PLATFORM == "powerpc-darwin" then # Mac OSX Panther
KALXMINUS = 63234 # Arrow Left Key
KARXPLUS = 63235 # Arrow Right Key
KAUYPLUS = 63232 # Arrow Up Key
KADYMINUS = 63233 # Arrow Down Key
KLTZDOWN = 44 # (comma) Less Than Key
KGTZUP = 46 # (period) Greater Than Key
KSHIFT = 131072 # Shift Key
KCONTROL = 262144 # Control Key
KNUDGEOK = true ;
else
KPLATFORM = "?"
end
end ;
Yeah, in the onKeyDown method, the keys are not OR'ed.
You'll figure it out. Again, I recommend adding a "puts" statement as the first instruction in your methods to show the key code and you'll what see gets passed when.
Todd
In my nudge script, I check for either the Shift Key or the Control key. I use the onKeyDown and onKeyUp methods to test for either key. When either key is pressed, I set a corresponding true toggle for that key. When it's raised, I set the toggle back to false.
Finally, when I'm looking for the arrow keys, I test for true for either toggle and adjust the move distance accordingly. For instance, SHIFT+any arrow key is a 10X movement in distance.
Todd
Well, define your use of "coplanar". Coplanar means "on the same plane". So:
if face1.plane == face2.plane then puts "faces are coplanar" ; end ;
Now, if you also mean 100% "coincident", then the defined bounding box of each face will match.
If you mean partially overlapping, then tests would have to be made with various points (vertices) on one face with the bounding box of the other face, and then vice versa as well.
Todd
No can do. The good news is that it's on the slate for V7.
Todd