Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

move an object

5 REPLIES 5
Reply
Message 1 of 6
mcolantuoni
704 Views, 5 Replies

move an object

Hi,
I'm new of Revit and Revit API.
I have to move an object, for example a table...or a desk.

I used the samples of the SDK and I tried the Move Linear. I have to move not a wall but an object.
Can anyone help me?

Thanks
5 REPLIES 5
Message 2 of 6
joelkarr
in reply to: mcolantuoni

an "object" is a family instance.

How do you want to select what to move?

You can either filter or use a modeless dialog and a select, or just use current selection made before the call to your application.

lets start there and see if we can get you started.
Message 3 of 6
MLandress
in reply to: mcolantuoni

Hi,
I have a similar question. I've Loaded and then inserted a Family Instance by using LoadFamilySymbol and then NewFamilyInstance.

commandData.Application.ActiveDocument.LoadFamilySymbol(RFA_FilePath, FamilyType)
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.
Thanks!!
Matt
Message 4 of 6
JamieVJohnson
in reply to: mcolantuoni

Hello questioning answer seakers,

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.

jvj
Message 5 of 6
MLandress
in reply to: mcolantuoni

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
Message 6 of 6
JamieVJohnson
in reply to: mcolantuoni

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.

jvj

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community