Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Move and rotate an element

  1. #1
    Member
    Join Date
    August 29, 2015
    Posts
    107
    Current Local Time
    08:05 PM

    Not allowed! Not allowed!

    Move and rotate an element

    Hi!

    How can i move and rotate an element with dynamo? For instance how can i move the element 30 mm and rotate it 90 degrees?

    I have find a function called "Elements. Rotate" like my picture here shows:
    Click image for larger version. 

Name:	rotate.JPG 
Views:	476 
Size:	24.5 KB 
ID:	23942

    But what do i put in "vector"? I want the element to rotate around its centerpoint!

    Best regards Arash

  2. #2
    Member
    Join Date
    May 30, 2015
    Posts
    210
    Current Local Time
    01:05 PM

    Not allowed! Not allowed!
    I believe the input needed is a x, y, z axis around which you will apply the rotation


    Sent from my iPhone using Tapatalk

  3. #3
    Senior Member amoursol's Avatar
    Join Date
    November 21, 2012
    Location
    Boston, MA (USA)
    Posts
    612
    Current Local Time
    08:05 PM

    Not allowed! Not allowed!
    Mengelmn is correct.

    For the Vector input you want 'Vector.ZAxis' (Or you can use Vector.ByCoordinates(0,0,1) in DesignScript). This means it will rotate around the ZAxis (ie. horizontally, not some random deformation in multiple vectors).

    The node you are using is a custom one I can't get working on my version here at work (0.8.0) unfortunately. But bear in mind that the base unit for angles in Dynamo is radians. So depending on how the custom node is set-up, you may need to incorporate a 'Math.DegreesToRadians' node into your workflow.

  4. #4
    Member
    Join Date
    August 29, 2015
    Posts
    107
    Current Local Time
    08:05 PM

    Not allowed! Not allowed!
    When I put in Vector.ByCoordinates(0,0,1) as the vector, then the element is jumping away and rotating, I guess that is because the element is rotating around the origo! I want the element to rotate around where it is standing, I want it to rotate around its midpoint!

    I also want to know how to move an element in x and y direction!

  5. #5
    Member
    Join Date
    May 30, 2015
    Posts
    210
    Current Local Time
    01:05 PM

    Not allowed! Not allowed!
    One answer is to utilize a cleaner Revit family that has a consistent origin - this is really just general good practice. Two there are methods to create a central point of rotation in Dynamo based on its geometry - I would suggest a quick web search.


    Sent from my iPhone using Tapatalk

  6. #6
    Member irneb's Avatar
    Join Date
    April 25, 2013
    Location
    Jo'burg SA
    Posts
    364
    Current Local Time
    09:05 PM

    Not allowed! Not allowed!
    If you cannot do that (i.e. use the FamilyInstance.Location node), you could use the element's BoundingBox. Either get hold of its CoordinateSystem (from which you can then get its Z-Axis as to rotate's axis - though it's most likely some arbitrary base point on one of the corners), or you could calculate the middle point and then define a z-Xais from that. Alternatively, install the clockwork package and use its Element.Location node.

    And then from that again point obtain a Z-Axis using the CoordinateSystem.ByOrigin and it's ZAxis.

    To actually "move" something is another matter. You'll need to find a custom node like you did for that RotateElement (sorry can't think of one off the top of my head just now), or you'd need to make your own. I'd say it's most probable to get it done using either Python (simpler to achieve) or even a C# DLL node (may work slightly faster). In Python you'd most likely use something like the ElementTransformUtils.MoveElement function.

    Just if you do this, ensure you've turned off the Automatic execution - you'd most likely run into an infinite loop as the element keeps on being rotated/moved. At least that's what I found when I tried this.

  7. #7
    Senior Member Ning Zhou's Avatar
    Join Date
    July 20, 2011
    Posts
    854
    Current Local Time
    12:05 PM

    Not allowed! Not allowed!
    Quote Originally Posted by irneb View Post
    ensure you've turned off the Automatic execution - you'd most likely run into an infinite loop
    is there a way to set default execution mode to manual, ini file perhaps (for 2016)? factory should set default to manual, makes no sense to set it automatic by default.

  8. #8
    Senior Member amoursol's Avatar
    Join Date
    November 21, 2012
    Location
    Boston, MA (USA)
    Posts
    612
    Current Local Time
    08:05 PM

    Not allowed! Not allowed!
    Personally I think it makes a lot of sense It just doesn't for certain workflows.

    Especially when you consider they are working on the ability for us to 'bake' scripts into our Revit projects.

  9. #9
    Senior Member Ning Zhou's Avatar
    Join Date
    July 20, 2011
    Posts
    854
    Current Local Time
    12:05 PM

    Not allowed! Not allowed!
    right Sol, automatic mode will make Dynamo "baked" into rvt so user can immediately see the result, from coding point of view it's better to have manual mode by default.

  10. #10
    Senior Member amoursol's Avatar
    Join Date
    November 21, 2012
    Location
    Boston, MA (USA)
    Posts
    612
    Current Local Time
    08:05 PM

    Not allowed! Not allowed!
    Fair enough!

Similar Threads

  1. Want to move (and rotate) my building, but doing so moves the PBP and starting origin
    By kescr in forum Architecture and General Revit Questions
    Replies: 5
    Last Post: July 25th, 2017, 03:45 PM
  2. Switching element type to Curtain element.
    By MPwuzhere in forum Architecture and General Revit Questions
    Replies: 7
    Last Post: February 27th, 2015, 10:07 PM
  3. Replies: 0
    Last Post: February 12th, 2015, 01:15 AM
  4. To rotate sheets or to rotate views
    By anthonyB in forum Architecture and General Revit Questions
    Replies: 6
    Last Post: April 19th, 2013, 03:19 AM
  5. Rotate element in family
    By Alfienoakes in forum Architecture - Family Creation
    Replies: 3
    Last Post: May 31st, 2012, 08:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •