sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Group moves to origin when I doubleclick to select component

    Scheduled Pinned Locked Moved Developers' Forum
    20 Posts 4 Posters 863 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Dan RathbunD Offline
      Dan Rathbun
      last edited by

      @tt_su said:

      You need to have the combined transformation of the specific path you want the world coordinate for. I don't see what type of method would improve over what one already do (collecting the nested transformation.) Suggestions are welcome.

      You know that is exactly what we'd like.

      We would like the heavy work done on the C-side, so it is fast, and we only need call a single method.

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • tt_suT Offline
        tt_su
        last edited by

        Like an optional argument in Vertex.position perhaps - that takes a transformation argument?

        1 Reply Last reply Reply Quote 0
        • tt_suT Offline
          tt_su
          last edited by

          Also, do anyone have a test script where current solution is slow?

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            @tt_su said:

            Like an optional argument in Vertex.position perhaps - that takes a transformation argument?
            Brainstormin'

            Umm. I was thinking more of a .world_position() instance method for Group and ComponentInstance classes.
            But this may not be the most helpful.

            Maybe think more of working in "Local" and "World" modes.
            And we gave a block form world and (maybe) local methods.
            (Sort of the old "with this do that" construct.)

            component_instance.world {|inst|
              # any vertice, point3d, vector3d, etc.,
              #  accessed within block is in world co-ordinates
            }
            

            ?

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • S Offline
              slbaumgartner
              last edited by

              @dan rathbun said:

              @tt_su said:

              Like an optional argument in Vertex.position perhaps - that takes a transformation argument?
              Brainstormin'

              Umm. I was thinking more of a .world_position() instance method for Group and ComponentInstance classes.
              But this may not be the most helpful.

              Maybe think more of working in "Local" and "World" modes.
              And we gave a block form world and (maybe) local methods.
              (Sort of the old "with this do that" construct.)

              component_instance.world {|inst|
              >   # any vertice, point3d, vector3d, etc.,
              >   #  accessed within block is in world co-ordinates
              > }
              

              ?

              Seems to me that to avoid complete chaos for Components, it would need to be necessary either to make any "world" version of the Component read-only or else to intercept all of the setter methods on Entities and apply the reverse transformation back to the ComponentDefinition's "local" coordinates. Otherwise, any modifications made to the "world" version within the code block would create a mess in the ComponentDefinition! This seems like a terrible amount of complexity and risk of bugs!

              Here's a different idea: what if there was a "export_to_world" method on ComponentInstance that would create a new Group containing copies of the ComponentDefinition's Entities transformed into "world" coordinates per that ComponentInstance's Transformation(s)? Because the copy's Entities would no longer be shared with the ComponentDefinition, there would be no risk of messing it up. Alterations made to the Group would not affect the ComponentDefinition or any of its ComponentInstances.

              Steve

              1 Reply Last reply Reply Quote 0
              • Dan RathbunD Offline
                Dan Rathbun
                last edited by

                Steve, my original idea is morphing into something overly complicated.

                I never wanted to imply a "world edition" of any Group or ComponentInstance instance object.

                I really meant that the origin (which is actually a property of a transformation object,) be returned in world co-ordinates instead of local co-ordinates. (So the instance object is not changed.)

                But this only within some scope mechanism. (A method block is only one such example.)


                Copying an instance into the world model entities, is easy enough now.

                I did not intend something that modified the model directly. I was aimed at simplifying virtual calculations.

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • Dan RathbunD Offline
                  Dan Rathbun
                  last edited by

                  @dan rathbun said:

                  @tt_su said:

                  Like an optional argument in Vertex.position perhaps - that takes a transformation argument?

                  Umm. I was thinking more of a .world_position() instance method for Group and ComponentInstance classes.

                  Oh.. sorry (brain fart)

                  Yes the position() method is on the Vertex class, so the proposed world_position(), would also have to be upon this class.
                  I do not known what would be better, a new method, or adding an optional :world symbol (or "world" string,) argument. (I DO know I hate positional boolean args, so I'd rather not see a default false arg, that we need to pass true in order to get world co-ordinates.)

                  Above, where I ponder about a scope (or method block,) ... creating any of the "virtual" dimension classes (in module Geom,) would return new object using world co-ordinates,. instead of local co-ordinates.

                  So in such a block edge.start.postion (for an edge that was nested at some level,) would return a new Geom::Point3d instance, but it's x, y, z would be set to world co-ordinates.

                  I'm not here much anymore.

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    slbaumgartner
                    last edited by

                    @dan rathbun said:

                    Steve, my original idea is morphing into something overly complicated.

                    I never wanted to imply a "world edition" of any Group or ComponentInstance instance object.

                    I really meant that the origin (which is actually a property of a transformation object,) be returned in world co-ordinates instead of local co-ordinates. (So the instance object is not changed.)

                    But this only within some scope mechanism. (A method block is only one such example.)


                    Copying an instance into the world model entities, is easy enough now.

                    I did not intend something that modified the model directly. I was aimed at simplifying virtual calculations.

                    So I guess I miss the point of the code block you suggested...what would it be iterating over?

                    1 Reply Last reply Reply Quote 0
                    • Dan RathbunD Offline
                      Dan Rathbun
                      last edited by

                      There is NO rule that states that code blocks must be iterative!

                      For example, normal begin ... end or do ... end code blocks are not themselves iterative. Nor are def ... end code blocks iterative.

                      A block of code is a scope mechanism. It can be iterated by calling it multiple times from an iterative expression such as for. Or a method block, can contain a for expression that calls a passed code block using a yield expression.

                      What I am proposing is most like the new Ruby 2.0 using keyword, and the refinement construct. In fact I said that above, where I called it a "with this do that" concept.

                      I'm not here much anymore.

                      1 Reply Last reply Reply Quote 0
                      • tt_suT Offline
                        tt_su
                        last edited by

                        @dan rathbun said:

                        Yes the position() method is on the Vertex class, so the proposed world_position(), would also have to be upon this class.

                        But you cannot return a single world position for a vertex unless you have some extra info. If the vertex belong to a definition with multiple instances there are multiple possible world positions.

                        And there was some mention of performance concern - did anyone have a sample script of this?

                        1 Reply Last reply Reply Quote 0
                        • Dan RathbunD Offline
                          Dan Rathbun
                          last edited by

                          @tt_su said:

                          But you cannot return a single world position for a vertex unless you have some extra info.

                          RIGHT.. I gotcha'

                          We would need to let Ruby know the parent instance's transform. (Not automatic unless in user edit mode.)

                          I guess we can do this now. We just create a copy of the instance's transformation, call it **t**:
                          world_pt = edge.start.position.transform(t)
                          I guess I was pondering how to automatically call #transform(t) upon all newly created Geom::Point3d instances, within a code block scope.

                          So, yes I suppose an optional "tranform" class argument for Vertex#position would be handy. (It could be a Geom::Transformation instance, a Geom::Vector3d in world context, OR either an Array or Geom::Point3d offset from ORIGIN.) So it could look like:
                          world_pt = edge.start.position(t)

                          (2) So lets say you have collected a series of vertices (in an array verts.) And you want their world co-ordinates:
                          world_pts = verts.map {|v| v.postion(t) }

                          We have to use map, because the API's Array#tranform() and Array#tranform!() methods, refuse to apply a transform to an array with anything other than than 3 numerics.
                          Even though each individual element has a transform method.

                          Example, you have an array of Geom::Point3d objects, and you want to transform ALL elements the same.
                          The Array class transform methods should do this IF the the elements are not numeric, and they respond_to?(:transform). (Add: Any element that does not "respond_to" is returned unchanged.))

                          💭

                          I'm not here much anymore.

                          1 Reply Last reply Reply Quote 0
                          • 1 / 1
                          • First post
                            Last post
                          Buy SketchPlus
                          Buy SUbD
                          Buy WrapR
                          Buy eBook
                          Buy Modelur
                          Buy Vertex Tools
                          Buy SketchCuisine
                          Buy FormFonts

                          Advertisement