There are other situations where you know you want to move an object along a specific direction, to an unknown distance. Click to finish the move.Įven though the direction and distance are arbitrary, you’ve technically provided that input to SketchUp, by referencing two points in the model. Snap to “point B”, or where you want the object to align to.Hover over and snap to “point A” on the object you are moving.There are other times, where you don’t know the direction or distance that an entity needs to be moved, and you need to rely on snapping to points in the model to define both of those inputs.įor example, if you wanted to snap a column to the corner of a deck, you’re essentially moving point A to point B. It’s irrelevant because you are overriding both direction and distance input via the keyboard. Something to note here is that you don’t need to click on any particular point in the model, or on the entity you are moving, as long as the entity is preselected. Type in 2' ENTER to define the distance.Tap the Right Arrow key to define the direction.Select the entities you want to move with the Select tool.This is pretty straight-forward since you know both the direction and distance. I can’t load this into Sketchup to check my logic or even the syntax, so keep us updated.Let’s say you want to move a group 2′ along the red axis. Instance = Sketchup.active_model.active_entities.add_instance(comp, trans) Trans = Geom::Transformation.new( face_normal )Ĭ_entities( trans.inverse, _a ) # Put into local coords # The face is now defined, but not assigned to a component instance, Since I don’t understand the entire process, I will attempt to create the face first, and then convert the component’s entities to local coordinates: comp = Sketchup.active_("TEST") We would like to figure out if the face’s normal is being reversed before the face is created. You said you want the local Z axis in the same direction as the push pull, but you are sometimes reversing the face normal, which will affect the transformation. I guess in theory I could also do my pushpull after I get the first 4 offset points. Then use the translate I’m already using? Which in theory brings it back to the original drawn position?.I an add instance which will be at the model origin now instead of where the user clicked.I then create my comp def using the offset points instead of the clicked points.I get the offset of all 8 cube points from the models origin.I’m currently attempting to choose the users first selected point as my comp origin and the pushpull direction as the Z axis in this line of code. I think I understand what your are saying about the offset, but am unsure how to approach that. That gif is the latter (correct origin placement, incorrect cube placement) I can get the cube to be drawn in the correct position, but then the origins are wrong OR I can get the origins correct, but the cube gets translated. If you watch my gif, the user clicks 4 points to create the cube. How do I get my cube to stay where it was drawn and my axes in the correct position like the video above? I’m sure I’m overlooking something simple or some other simple way to achieve this. This one positions and rotates my axes correctly in the direction I pushpulled, but it moves and rotates my component instance from it’s original drawn position. But this leaves the component instance in the correct position the user drew it at. I’m aware my trans = Geom::Transformation.new line is placing my axes at the origin. Here is my tools create_cube method after the user selects their 4 points comp = Sketchup.active_("TEST")įace = _face unless = Geom::Transformation.new I’m not statically drawing a cube so I can’t just fallback to starting the cube at 0,0,0 then translate it. I’m not sure your solution exactly works though. I only used to_component to quickly showcase my problem. Screenshot showing the components axis are attached to the models origin. I already have my vector, I just don’t now how to force my components origin to be where the component was initially created and set the Z axis to my vector. My cube tool can be drawn at any angle, so I want to set the Z axis to be set to the vector I pushpulled my cube. My goal is to have the origin set at the first point, and Z axis in the chosen direction. I’ve tested the sample hellocube example and turned it’s result into a component just to ensure it wasn’t some other bug in my custom tool. Once I add the component instance, if I go into the model and right click my component and “Change Axes”, I see that the components axes are attached to the models origin instead of the component itself. I’m working on a tool to draw cubes and turn them into components.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |