sketchucation logo sketchucation
    • Login
    1. Home
    2. kwalkerman
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    K
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 28
    • Posts 148
    • Groups 1

    Posts

    Recent Best Controversial
    • Get objects at specified poitn

      Is there any way to get all the objects at a specific point in 3d space, other than model.raytest? In this case, I know the exact 3d coordinate.

      Thanks,

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: [Plugin] Hole Punching Tool

      TIG,

      I've been using this tool and love it, however, I've come across some strange behavior when shadows are turned on...

      When viewing the building from the outside, shadows show correctly:
      Shadows Viewed From Outside

      but when I place the camera inside the building, something strange happens with the shadows...

      Shadows viewed from inside

      The same window attached to a single surface correctly displays shadows from inside and outside.

      I'm not sure why this is happening... It very likely has something to do with how my windows are constructed (I am using TIG's suggested method of creating a separate cutting surface than the window geometry).

      Thanks,

      --
      Karen

      posted in Plugins
      K
      kwalkerman
    • RE: Model.raytest and Entity visibillity

      Ok, so here's an issue with the new way raytest works (ie it sees all entities, visible and hidden).

      There are times when a ray will hit multiple entities at the same point. In SU 7, model.raytest will return only one of those entities. It's easy to find all entities by hiding any entities that are hidden, but under the new version of SU, only one of the entities will be found. Another thing, which is interesting, is that if there are multiple entities in the same location, SU will return the same entity first, regardless of the direction of the ray.

      Try this code:

      
      model = Sketchup.active_model
      p1 = Geom;;Point3d.new(0,0,0)
      p2 = Geom;;Point3d.new(20,20,0)
      p3 = Geom;;Point3d.new(0,20,0)
      f = model.entities.add_face(p1,p2,p3)
      model.entities.add_group([f])
      model.entities.add_face(p1,p2,p3)
      p4 = Geom;;Point3d.new(5,10,-5)
      p5 = Geom;;Point3d.new(5,10,5)
      ray1 = [p4, Geom;;Vector3d.new(0,0,1)]
      item1 = model.raytest ray1
      ray2 = [p5, Geom;;Vector3d.new(0,0,-1)]
      item2 = model.raytest ray2
      item1 == item2
      
      #==> returns TRUE!
      
      

      I can't currently think of a ruby workaround for this. The new version of raytest will limit the ability to get all objects at a certain location.

      As I suggested before, I think it makes the most sense to extend the native raytest so that you can specify whether or not you want the ray to be allowed to show hidden objects.

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Model.raytest and Entity visibillity

      Weird. Are they homing in on anything consistent?

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Model.raytest and Entity visibillity

      I've been using model.raytest on SU 7.1 pro. It has not seen hidden entities (which I like!)

      Sounds like in SU 8, things are all messed up. Maybe a new raytest method could be developed where you can specify whether the ray is allowed to return something hidden or not?

      posted in Developers' Forum
      K
      kwalkerman
    • RE: [Plugin] Select by Material, and Hide All Unselected

      Bob (and CadFather),

      I wanted to leave them separate because I thought 'hide all unselected' could be useful for other applications... But I think I can figure out a fly-out.

      --
      Karen

      posted in Plugins
      K
      kwalkerman
    • RE: Entities.add_group(ents)

      ... actually this works if you want to create a sub-group that includes all entities of the parent group, but not if you want to create a sub-group that includes only SOME of the entities of the parent group. For instance, I start with a box, and I create one group for all walls, another for all roofs, and another for the floors.

      I guess I could create multiple sub-groups using your method, and then erase everything that I don't want out of each group. Aarg! This is much more calculation intensive that I want!

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Entities.add_group(ents)

      TIG,

      Ahh, I tried something similar a few days ago, but I think yours has an extra twist or two that just might work!

      I'll give it a try.

      Thanks,

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Entities.add_group(ents)

      TIG,

      try my test sample. It doesn't work unless model.active_entities is equal to the entities to which you are adding a group. I know that model.active_entities is a shortcut.

      try my test sample. Just try it.

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Entities.add_group(ents)

      TIG,

      so let's back up for a minute.

      What my code does, is look for certain existing items within a group (all items are within the same group), and creates sub-groups based on the items having certain characteristics, just like if you were editing a group, selected a few faces, right-clicked and said 'make group'. I want the user to be able to run the script on multiple groups at once, so the components to be grouped, will be part of active groups, but not part of model.active_entities when the script is run.

      Am I making sense? Is this completely impossible? Is there some reason I'm overlooking that makes this unrealistic?

      Thanks,

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Entities.add_group(ents)

      TIG,

      I see what you're saying... but the issue is not that the parent entities are not the same, but that model.active_entities is not equal to parent.entities.

      Try this:

      create a simple model, draw a rectangle and pull it up.

      in the ruby console:

      model = Sketchup.active_model
      s = model.selection

      now select the group.

      in the ruby console:
      g = s[0]

      now add a new group to g.entities, through the ruby console

      new_g = g.entities.add_group(g.entities.to_a)

      So... is this an official bug that needs to be logged with the SU team? How do I go about doing that?

      Thanks!

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Entities.add_group(ents)

      Thom,

      Ok, sorry for wasting your time. I wrote that post late last night. It should read (and what I've been testing)

      1. draw a cube, open the cube for editing (make sure the origin is NOT 0,0,0), and select a face
      2. in the ruby console:
        s = Sketchup.active_model.selection
        f = s[0]
      3. now exit the group, and select the group, then in the ruby console
        g = s[0]
      4. now for the fun
        g2 = g.entities.add_group(f)
        ok, so a group was added to model.entities, and in a strange location... Now double click your original group to edit it... the face moves!!

      And, from this morning... I did mean Sketchup.active_model.active_entities.

      I have run a few tests and it seems that if you try to create a group by passing in entities, the only time it works is when the parent entities collection equals the model.active_entities collection.

      I could find a decent workaround if there was a way to change the active path of the model!!

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Model.raytest broken in SU8!

      @unknownuser said:

      Lads, this needs to be fixed on SU Team level urgently! Looking for a workaround is desired, but why we developers have to fix something that is wrong on C++ level, not in Ruby! 😒
      Do you expect new maintenance release in the end of 2011?

      Agreed!!!

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Entities.add_group(ents)

      Thom,

      I read your post on this method, from the 'change parent' thread, with much interest, hoping it would offer a solution. My issue is creating the group in the first place. Usually in SU, when a group is created of existing components, it is after the user has selected a bunch of components, and therfore model.active_entities is equal to any of the selected items parent.entities. Adding a sub-group to the component is easy. Just say parent.entities.add_group(entities), and everything works fine.

      However, if your list of entities is not equal model.active_entities, even though all my entities have the same parent, and the group I am creating would have the same parent, when you do parent.entities.add_group(entities), the new group shows up in the outliner as existing within model.entities, and not parent.entities. Furthermore, more strange stuff happens when you edit the parent group.

      Try my ruby console example.

      I really appreciate the feedback too, by the way.

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Entities.add_group(ents)

      I've had a few PM's on this issue, so I'll post some clarifications:

      I've tried adding things a few different ways. The only way I can properly add a group to a group.entities that is not the active entities is to add an empty group. Then, you need to add faces, by using entities.add_face. This means that you either have to manually copy all attributes, materials, etc, or you lose some of these attributes. It also seems like a very round-about way of doing things. If I say Building_Geometry_Group.entities.add_group(face), where face is an existing face, this creates some very strange results.

      Try the following by using the ruby console:

      1. draw a cube, open the cube for editing (make sure the origin is NOT 0,0,0), and select a face
      2. in the ruby console:
        s = Sketchup.active_model.entities
        f = s[0]
      3. now exit the group, and select the group, then in the ruby console
        g = s[0]
      4. now fur the fun
        g2 = g.entities.add_group(f)
        ok, so a group was added to model.entities, and in a strange location... Now double click your original group to edit it... the face moves!!

      This is my conundrum.

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • Entities.add_group(ents)

      I know that entities.add_group is buggy when you pass an entity collection to it. It seems to work OK as long as the entities collection you are adding to is the active path, or model.entities.

      Is there any way to add a group of already existing components to a group using code, and regardless of what entities collection is active in the model?

      For example, in the outliner I have

      Building_Geometry_Group
      -->Exterior_Walls
      -->Win1
      -->Win2
      -->Roof
      -->Foundation

      Now I want to group the exterior walls and windows together into one group. I'd like to go:

      walls_and_windows = Building_Geometry_Group.entities.add_group([Exterior_Walls, Win1, Win2])

      But this adds walls_and_windows to model.entities, and messes up the transformation completely, often followed by a bugsplat. Is there any workaround for this?

      Thanks,

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: [Plugin] Select by Material, and Hide All Unselected

      Bob - I sent you a PM, asking to see the model you are having difficulty with. Did you get everything figured out?

      --
      Karen

      posted in Plugins
      K
      kwalkerman
    • RE: [Plugin] Hole Punching Tool

      TIG,

      one option for Gaieus' suggestion is to add a Tools Observer, if a punching component is in the selection, the move tool is active, and the tool goes to 'copy' mode, then un-select the linked components and copy only the hole punching component... or would this mess with some other functionality with the tool??? It would be handy though.

      Again, awesome plugin. I've been waiting for something like this for a looooong time.

      Thanks again,

      --
      Karen

      posted in Plugins
      K
      kwalkerman
    • RE: [Plugin] Select by Material, and Hide All Unselected

      The more I think about the option to 'get' the material under the cursor, the less it makes sense to me to add it into the plugin. I really like the fact that you can choose a material from the materials browser for selection. This way, you can choose to select something that you don't want in your model (or can't find), such as unpainted surfaces.

      If you left the current functionality, and added the ability to get the material under the cursor, this would add a step to the process, which makes it no better than doing the following:

      1. Pick a material with the built-in SU picker
      2. Select materials

      Let me know what you think.

      --
      Karen

      posted in Plugins
      K
      kwalkerman
    • RE: [Plugin] Hole Punching Tool

      TIG,

      #2 makes sense. Thanks for updating the plugin with an app observer. Definitely an awesome tool.

      --
      Karen

      posted in Plugins
      K
      kwalkerman
    • 1 / 1