My current script will place a block at the closest point on a line when given an input object. What I’d like to do is move the chosen object to that closest point instead of creating a new block reference and I feel like I’ve gotten pretty close in my attempts but I think coordinate systems are tripping me up.
Shouldn’t the vector I’ve created be translating the coordinates of the block towards the line as desired? It moves the block instead along a vector that seems to be equal to model space origin > new point, that is, it moves the block up and right instead of back and left. Is there a simpler way to set a blocks coordinates in the model space? I don’t seem to have as simple a method as is available for geometry via the Geometry.Transform node.
I saw that thread in my searches prior but the move is relative to the current location. How do I move the object to a specified model space coordinate or compute a coordinate system that results in moving the block to the model space coordinate? That was my attempt with the vector but it doesn’t produce the result I wanted.
You’d need to figure out the X and Y shift from the current location to the desired location and then create the transform coordinate system with the origin located at those coordinates.
Example:
Current location = (100, 100)
Desired location = (20, 20)
Origin of transform coordinate system = (-80, -80)
Yes, but I think the issue was that you were translating the coordinate system of the block reference to its desired location instead of creating a new coordinate system with the shift. Here’s an equivalent method of what you outlined above.
As a side note, the background of all of this is transform matrices, which is how objects are transformed programmatically in AutoCAD. Dynamo just uses a Coordinate System object to do the same thing.