Cheers TIG, that did the trick.
Latest posts made by peterjohnson84
-
Getting normal to cylinder face
Hi there,
I am having some trouble with some code I'm writing and was wondering if there was a simple solution that I'm unaware of.
My aim is to find vector the normal to a cylinder face (where the cylinder has beeen 'stored' as a group) and from that, work out the orientation of the cylinder group. So far, I have been able to do this for a cylinder which I created. However if I rotate the cylinder and perform the same operation, the normal vector does not change with the rotation i.e. if I create a cylinder aligned along the z axis - circle.normal will always give (0,0,1) despite any rotation i perform on the group.
I assume the information about the rotation is stored somewhere and from this I could work out the cylinder orientation - but I'm at a loss to work out how to do this.
Any help with this would be greatly appreciated.
-
RE: Interrogating each group to find Cylinders & Cubes
That's the badger! Though as is the way with these things, it seems so simple once I know the solution.
Thankyou very much anyway...that has helped me a great deal.
-
RE: Interrogating each group to find Cylinders & Cubes
I am also working on this problem and though I follow the logic behind the code you wrote - I am struggling to implement it.
How do you get sketchup to recognise the group.(...) method? i.e. stop it returning the error:
undefined local variable or method `group' for JF::WebConsole:Module
when I type:
face=nil group.entities.each{|e| if e.class==Sketchup;;Face face=e break end } not_cuboid=false not_cuboid=true if face.edges.length!=4 faces=[]; face.all_connected.each{|e|faces << e if e.class==Sketchup;;Face} not_cuboid=true if faces.length!=6 faces.each{|f| if f.edges.length!=4 not_cuboid=true break end }
Its as if sketchup doesn't know what group I'm referring to - doesn't know what 'group' even is. After searching I have noticed some talk about 'active_entities' and suspect the answer may be invlved with this somehow.
Apologies if this sounds like nonsense - I think I'm missing something big, but can't work out what it is.
Cheers, Pete