Revit API

Reply
New Member
mcolantuoni
Posts: 2
Registered: ‎04-23-2009
Message 1 of 6 (252 Views)

move an object

252 Views, 5 Replies
09-22-2009 06:01 AM
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
Active Contributor
joelkarr
Posts: 30
Registered: ‎11-25-2008
Message 2 of 6 (252 Views)

Re: move an object

09-30-2009 12:11 PM 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.
Member
MLandress
Posts: 3
Registered: ‎08-21-2001
Message 3 of 6 (252 Views)

Re: move an object

03-18-2010 06:50 AM 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
Distinguished Contributor
JamieVJohnson
Posts: 136
Registered: ‎09-29-2008
Message 4 of 6 (252 Views)

Re: move an object

03-18-2010 07:19 PM 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
Member
MLandress
Posts: 3
Registered: ‎08-21-2001
Message 5 of 6 (252 Views)

Re: move an object

03-19-2010 10:32 AM 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
Distinguished Contributor
JamieVJohnson
Posts: 136
Registered: ‎09-29-2008
Message 6 of 6 (252 Views)

Re: move an object

03-19-2010 10:41 AM 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Revit Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Revit

Twitter

Facebook

Blogs

Youtube