I have a similar question. I've Loaded and then inserted a Family Instance by using LoadFamilySymbol and then NewFamilyInstance.
Dim ptInsPoint As New XYZ(0.0, 0.0, 0.0)
Dim FurnItem As FamilyInstance = commandData.Application.ActiveDocument.Create.NewFamilyInstance(ptInsPoint, symbol, Structural.Enums.StructuralType.NonStructural)
This is a furniture item like a table, desk, filing cabinet, etc. Now I would like to move that item so it's on the cursor and someone can place it wherever they would like. I have the item from the FurnItem variable when inserting a NewFamilyInstance but now I need to be able to move it. I've tried the different options from move elements in the API but haven't found anything to get it to work yet. Any help would be appreciated.
To move an object, you must do work on its "location". A location can be a Point or a Curve, depending on the nature of your object. So you get this: element.location, then set it to this LocationPoint, or LocationCurve. Then that object gives you the points you need, or just the command move you need to do the work. LocationPoint.Point = XYZ object you can manipulate directly or swap out with another. LocationCurve.Curve.Endpoints(0) and Endpoints(1), gives you the start and stop points of a line(or arc). which again you can manipulate or swap out. Plus Location gives you a Location.Move and Location.Rotate ability without having to change the points directly.
Thanks for your reply Jamie. I was able to move the object but in a predetermined format. I can pick an object/family, get the location point of it and then move the newly inserted family to that objects location point.
commandData.Application.ActiveDocument.Move(FurnItem, New XYZ(lp.Point))
It works great but really what I would like to do is to be able to run a move command where I start off using the main location point such as New XYZ(0.0,0.0,0.0) and then have the item on my cursor to place where I need it. Basically like the move command works within Revit.
Sorry if this is an easy thing or I'm not understanding something but I'm rather new to the API.
Thanks for any answers in advance!
Matt, I have not run across a method to 'dynamically' move an object using the api. The only method I have heard of is to use a send keys that will run the ribbon command in revit itself. As such, you CAN add/remove objects to the doc.selection.elements collection. That could be the route you choose.