How to create a parametric model and adjust all its parameters?

How to create a parametric model and adjust all its parameters?

Anonymous
Not applicable
1,262 Views
6 Replies
Message 1 of 7

How to create a parametric model and adjust all its parameters?

Anonymous
Not applicable

Hello everyone

 

I'm trying to create a parametric model and adjust its parameters through API. When I create an element through the family editor, I can import the element into the project and place it on a reference plane. But, As you know, the reference plane doesn't let us move the element freely in the 3D space, and movement on the plane is only possible.

 

I'd like to know, Is it possible to create a parametric shape and move it freely in the 3D space?

I could find some references about "direct shapes"; can those shapes make this end possible for us? 

What would you suggest to me as a starting point in this regard?

 

Many thanks in advance!

0 Likes
Accepted solutions (1)
1,263 Views
6 Replies
Replies (6)
Message 2 of 7

RPTHOMAS108
Mentor
Mentor

1) Things can be offset from a plane so therefore can be manipulated in three directions, rotation around something other than the normal of that plane is more tricky. Although Revit isn't AutoCAD so the idea is for items to relate to datums. What you draw in 3D become what you document in 2D.

 

2) Adaptive components can be authored around a set of points with those points defining the objects orientation (points can be placed in 3D space as you like).

 

Message 3 of 7

Anonymous
Not applicable

Thanks for your answer

 

Can you explain a little bit more about adaptive components? Did you mean the components that are created in the Family editor part?

 

How about direct objects; do they need a reference plane again?

I'd be grateful if you could guide me more; that's very important for me.

 

Best,

Saeed.

0 Likes
Message 4 of 7

stever66
Advisor
Advisor

I think the general idea is that sometimes you just need to move the reference plane to move your family.

 

For example if you are modeling light fixtures, they might be placed on a plane called “ light fixture elevation”.   If you want to move the lights higher or lower, you would just move the reference plane.

 

If you are modeling a box, you might have 6 reference planes.  Moving any one changes the size and shape of the box.  To change the position of the box, you would move lo 6 reference planes.

Message 5 of 7

Anonymous
Not applicable

Thanks a lot

 

That's right, a solution that comes to mind is to modify the location and orientation of reference planes. But, this makes the problem very complicated because the parameters of the shape and reference planes should be adjusted at the same time.

 

I had seen some examples of Direct shapes in which there wasn't any sign of reference planes. I'd want to be sure about direct shapes that if they work out well in such a problem or not?

 

Isn't there any better solution? (I feel like manipulating reference planes is the hardest approach that we can have)

 

Best,

Saeed

0 Likes
Message 6 of 7

stever66
Advisor
Advisor

You could try the examples in the help, and then see if you can move the shapes;

 

http://help.autodesk.com/view/RVT/2016/ENU/?guid=GUID-DF7B9D4A-5A8A-4E39-8721-B7782CBD7730


It looks interesting.  I might even try it if I have time sometime.

Another thought, when you create a family, a lot depends on the template you start with.  If you start with a face based family, that family will always need a face to be hosted too.  Try starting with an unhosted family template.   

Message 7 of 7

sragan
Collaborator
Collaborator
Accepted solution

I got both examples to work without too much trouble.  And I could move both shapes freely around in a 3D view - both up and down and side to side.  So I think thats what you wanted.

 

Make sure you start with the code and help for the right version of Revit - apparently there has been a change to the arguments for the Directshape.CreateElement.  The link I provided was for Revit 2016, but I actually used Revit 2021.

 

For Revit 2021, I had to modify the list create lines.  For the sphere, I used:

 

List<Curve> profile = new List<Curve>();

 

and for the pyramid I used:

 

List<XYZ> loopVertices = new List<XYZ>(4);

 

To get a materialID for the pyramid, I used:

 

 

FilteredElementCollector elementCollector = new FilteredElementCollector(doc);
					elementCollector.WherePasses(new ElementClassFilter(typeof(Material)));
					IList<Element > materials = elementCollector.ToElements();

					Material mymaterial = null;
					string MaterialName = "Default";

					foreach (Element materialElement in materials)
							{
    							Material material = materialElement as Material;
    							if (MaterialName == material.Name)
    								{
        								mymaterial = material;
        									break;
    								}
				
							}
								
					ElementId materialId = mymaterial.GetTypeId();