⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • FaceMe - Ruby\SU bug?

    2
    0 Votes
    2 Posts
    195 Views
    K
    Something similar happens when you create a new group inside an existing group that consists of existing components. See this thread: http://forums.sketchucation.com/viewtopic.php?f=180&t=31443&p=276973&hilit=kwalkerman#p276860
  • Transformations

    29
    0 Votes
    29 Posts
    2k Views
    C
    @zitoun said: I have no clue what these are yet, but I guess I somehow can retrieve my rotation matrix from such component... Note that a transformation has the .to_a method as well which gives you exactly the information you're looking for. The array it returns is 16 floats for the four by four matrix which defines the transformation from the components defining coordinate system to the current coordinate system. Since you mentioned quaternions I'll assume you're familiar with with the essentials of matrices and linear transformations. First, we can interpret the scaling and rotation of a component as the action of a matrix on the basis vectors of the component definition. Say for example you define your component relative to the standard basis of x=[1,0,0], y=[0,1,0], z=[0,0,1]. Rather than keeping these vectors separately, you can just encode them as the 3x3 identity matrix, and then define all the entities in the component relative to this matrix. From here, any sort of rotation/scaling can be interpreted as a change of basis. The trouble of course is that any linear transformation preserves the zero vector, so you can't model a translation in this way. This means to fully describe the relative coordinates you require a an equation of the form Ax + b where A is an invertible 3x3 change of basis matrix and b is the translation vector with x being the "defining" vector of some entity internal to the component. This is where the clever bit comes in. You can model an affine transformation of the form Ax + b as a single matrix transformation by embedding it into a space with one higher dimension. This is why the transformation.to_a method returns a 16 entry array, it's a 4x4 matrix with the first four entries being the first column, the second four entries being the second column and so on. It's easy enough to extract the original 3x3 matrix and the translation vector as well, the "upper-left" 3x3 block matrix is exactly the change of basis matrix A, and the final column vector is of the form [b, 1] where b is the translation vector. From here extracting the rotation matrix is a simple matter of matrix algebra since any change of basis matrix A can be decomposed as A = QS where Q is a rotation matrix and S is a diagonal matrix representing the scaling of each axis. It's worth getting to know the 4x4 representation if you haven't before since it's also the way the OpenGL standard models the objects. The ability to model vector addition as matrix multiplication is only one of the reason they do it, the other being that when you're rendering perspective views rather than simply orthographic views the value of the bottom right entry plays an important role in correcting the scale of the transformation after applying the perspective matrix.
  • Customized 3D Warehouse link

    5
    0 Votes
    5 Posts
    949 Views
    Al HartA
    I presume part of the cookie must specify the SketchUp version - so users don't try to download components they cannot load. I will be interested if there ideas can turn into a way to select and download components. What I would like to do it have a dialog which starts at a specific collection in the 3D Warehouse - such as this one - so users can download trees: http://sketchup.google.com/3dwarehouse/cldetails?mid=dfd59a8e2e744892e05349688101e4b4 or else starts with a search, such as http://sketchup.google.com/3dwarehouse/search?q=IRender+nXt&styp=c [image: 6bu2_IRendernXtPlants2.jpg]
  • Selecting All Visible Faces

    17
    0 Votes
    17 Posts
    6k Views
    thomthomT
    @gude said: I couldnt understand the way they did it here http://forums.cgsociety.org/archive/index.php/t-197347.html That is the method I mentioned earlier - it selects the faces which normal is pointing towards the camera - but it doesn't take into account other faces blocking the view.
  • Duplicate "edit component" with api methods.

    11
    0 Votes
    11 Posts
    527 Views
    honoluludesktopH
    Thanks, fellows. Sometimes it's not as simple as I think, then after I'm done, its simpler then I think:-) Tig, That's neat, didn't know I could do that. The reverse face application requires the faces to be in Sketchup.active_model.entities. The faces are picked in terms of it's pixel location on the monitor. Maybe I first have to group the loose entities, then process all the groups, and components one at a time. Sometimes I write this stuff, just to see if I can. It doesn't take that much more work to open each component manually, and run the plugin Reverse_Backfaces each time.
  • Intercept UI::Command.new ?

    7
    0 Votes
    7 Posts
    374 Views
    PixeroP
    Very interesting. Awaiting your TT_toolbarTool...
  • ComponentInstance.explode

    5
    0 Votes
    5 Posts
    295 Views
    honoluludesktopH
    Thanks, gotit. Hope I don't forget!-)
  • Best way to get all Face's in model?

    25
    0 Votes
    25 Posts
    2k Views
    S
    @thomthom said: ............ 2. Exploding is very slow in SU. ( and if your script should fail at some point and halt - you're left with a broken model. ) ok! I changed my way and it seems work alot faster! (for my plugin converter 2 POV-Ray script). note: At this time I get only the color of the parent object(s) and not texture... def pov_find_faces(entities,tform,layername) entities.each do |entity| if entity.is_a?(Sketchup;;Face) pov_write_face(entity, tform) elsif entity.is_a?(Sketchup;;Group) if entity.material if entity.material.color $levelcolor[$level]=entity.material.color else $levelcolor[$level]=$levelcolor[$level-1] end if entity.material.alpha $levelalpha[$level]=entity.material.alpha.to_s else $levelalpha[$level]=$levelalpha[$level-1] end else $levelcolor[$level]=$levelcolor[$level-1] $levelalpha[$level]=$levelalpha[$level-1] end $level+=1 pov_find_faces(entity.entities,tform * entity.transformation,entity.name) elsif entity.is_a?(Sketchup;;ComponentInstance) if entity.material if entity.material.color $levelcolor[$level]=entity.material.color else $levelcolor[$level]=$levelcolor[$level-1] end if entity.material.alpha $levelalpha[$level]=entity.material.alpha.to_s else $levelalpha[$level]=$levelalpha[$level-1] end else $levelcolor[$level]=$levelcolor[$level-1] $levelalpha[$level]=$levelalpha[$level-1] end $level+=1 pov_find_faces(entity.definition.entities,tform * entity.transformation,entity.name) end end $level=$level-1 #UI.messagebox($level.to_s) end
  • Recursive print_group_tree() help

    12
    0 Votes
    12 Posts
    652 Views
    honoluludesktopH
    tt, This recursive stuff really works! Below drills down into component instances. Now, on to add groups. def get_ci(ci_array) entities = Sketchup.active_model.entities entities.each do |ent| if ent.is_a? Sketchup;;ComponentInstance ci_array.push ent end end return ci_array end def explode_ci_array(ci_array) ci_sub_array=[] ci_array.each do |ci| if ci.is_a? Sketchup;;ComponentInstance ci_sub_array=ci.explode end end return ci_sub_array end ci_array=[] found = false while found == false ci_array=get_ci(ci_array) ci_array=explode_ci_array(ci_array) if ci_array[0] == nil found = true end end
  • File access speed

    9
    0 Votes
    9 Posts
    462 Views
    honoluludesktopH
    All this time I labored under the belief that only old programs up to Win98 ran in the command window, and didn't ever try.
  • Get_datfile_info

    2
    0 Votes
    2 Posts
    205 Views
    thomthomT
    The file seem to be a config file of SU. @unknownuser said: // NOTE TO USERS: Making modifications to this file is not recommended as it will be overwritten // each time an upgrade is installed. I don't see much useful info in it for us... Possibly it could be used to brand SU - but as the file warns - it'll be overwritten upon SU updates...
  • Small face fails

    5
    0 Votes
    5 Posts
    382 Views
    S
    @jim said: You may be able to use a PolygonMesh instead of adding each Face. The mesh will also be faster to create than individual faces; but which is better depends on your goal. See also: http://code.google.com/apis/sketchup/docs/ourdoc/entities.html#add_faces_from_mesh http://code.google.com/apis/sketchup/docs/ourdoc/entities.html#fill_from_mesh Yes I thank you, but I am working about some interfaces between SketchUp and other CAD system. At this moment I am unable to find the unique criterion that SkUp uses to dispense the order of the ponts in the mesh. Especially about faces edited by subtraction of other faces or with holes. The mesh is really difficult to decode because the vertexes seem to hop and to return using a lot of different combinations. This is really laborious and so I use to split triangular faces, that in CAD is a 4 vertexs faces with a duplicated vertex, or, where it'i possible, a couple of SkUp triangles that are a unique (cad) 3DFACE. Anyway I thank you very much, because I'll to import also textures, and I will need of the meshes also, I fear... Excuse my bad english..
  • Manipulate a ruby from command line?

    11
    0 Votes
    11 Posts
    673 Views
    M
    ah, OK cheers Jim. It looks like it will be possible one way or another! now I know its possible, time to hunt down someone with the capabilities Thanks a lot for the help, Tom
  • Groups to components plugin ploblem

    8
    0 Votes
    8 Posts
    399 Views
    thomthomT
    hmm... that can be a problem with symmetrical objects like this - there are several possible ways to orient them...
  • Help with ruby

    4
    0 Votes
    4 Posts
    2k Views
    A
    My previous ruby file didn't even have the ./ to delete.in that script... tried for days to make it work. Cleared up now with this one ..Many Thanks :O)
  • Get objects at specified poitn

    11
    0 Votes
    11 Posts
    560 Views
    Chris FullmerC
    Good question, hopefully soon. Now we'll have to add a version check to make sure people are not running SU 8, original release. But that's ok, the fix will be well recieved.
  • A clone of an active_view.camera

    9
    0 Votes
    9 Posts
    381 Views
    TIGT
    But it is a transient setting! If you click in the view it evaporates... It would be good if it were accessible but it is pretty transient...
  • Close webdialogs on File-New/Open

    14
    0 Votes
    14 Posts
    794 Views
    Dan RathbunD
    Agreed. I logged several Feature Requests for MDI support (new methods) in the API, including a Models collection.
  • Face Me

    9
    0 Votes
    9 Posts
    527 Views
    thomthomT
    What makes it more troublesome is that the documentation doesn't mention bugs that appeared in the various methods in the various SU versions.
  • Vector transformation ... whut?

    3
    0 Votes
    3 Posts
    278 Views
    thomthomT
    Never - my brain was being silly.

Advertisement