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: 

Revit 2014 Form Extrusion Height

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
540 Views, 1 Reply

Revit 2014 Form Extrusion Height

Anonymous
Not applicable

Hi all,

in revit 2014 when I try to use a code to set extrusion height in conceptual mass, it fails when I try to set extrusion.TopOffset, this is mycode.

Any idea or samples to set TopOffset in conceptual mass from revit api?

Thanks in advance

Max

 

  using (SubTransaction sub1 = new SubTransaction(famDoc))
                    {
                        sub1.Start();
                        extrusion = famDoc.FamilyCreate.NewExtrusionForm(true, array2, xyz2);                      
                        sub1.Commit();
                    }
                    if (null != extrusion)
                    {
                        listaEXT.Add(extrusion);
                        using (SubTransaction sub2 = new SubTransaction(famDoc))
                        {
                            sub2.Start();
                            extrusion.TopOffset = h;
                            sub2.Commit();
                        }
                    }

0 Likes

Revit 2014 Form Extrusion Height

Hi all,

in revit 2014 when I try to use a code to set extrusion height in conceptual mass, it fails when I try to set extrusion.TopOffset, this is mycode.

Any idea or samples to set TopOffset in conceptual mass from revit api?

Thanks in advance

Max

 

  using (SubTransaction sub1 = new SubTransaction(famDoc))
                    {
                        sub1.Start();
                        extrusion = famDoc.FamilyCreate.NewExtrusionForm(true, array2, xyz2);                      
                        sub1.Commit();
                    }
                    if (null != extrusion)
                    {
                        listaEXT.Add(extrusion);
                        using (SubTransaction sub2 = new SubTransaction(famDoc))
                        {
                            sub2.Start();
                            extrusion.TopOffset = h;
                            sub2.Commit();
                        }
                    }

1 REPLY 1
Message 2 of 2
jeremytammik
in reply to: Anonymous

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear Max,

 

Looking at the Form.TopOffset property in the Revit API help file RevitAPI.chm, I note the statement:

 

"Retrieve/set the top offset of the form object. It is only valid for locked form."

 

Question: is your form locked?

 

No, obviously not, since you just created it.

 

If you are simply trying to set the extrusion height, I suggest you look here at some examples:

 

http://thebuildingcoder.typepad.com/blog/2014/10/creating-a-sloped-wall.html

 

http://thebuildingcoder.typepad.com/blog/2011/06/creating-and-inserting-an-extrusion-family.html

 

Note what the documentation of the FamilyItemFactory.NewExtrusionForm method states about the direction argument:

 

direction: Type: Autodesk.Revit.DB.XYZ; The direction of extrusion, with its length the length of the extrusion. The direction must be perpendicular to the plane determined by profile. The length of vector must be non-zero.

 

RTFM, my friend.

 

Saves you a subtransaction as well.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Dear Max,

 

Looking at the Form.TopOffset property in the Revit API help file RevitAPI.chm, I note the statement:

 

"Retrieve/set the top offset of the form object. It is only valid for locked form."

 

Question: is your form locked?

 

No, obviously not, since you just created it.

 

If you are simply trying to set the extrusion height, I suggest you look here at some examples:

 

http://thebuildingcoder.typepad.com/blog/2014/10/creating-a-sloped-wall.html

 

http://thebuildingcoder.typepad.com/blog/2011/06/creating-and-inserting-an-extrusion-family.html

 

Note what the documentation of the FamilyItemFactory.NewExtrusionForm method states about the direction argument:

 

direction: Type: Autodesk.Revit.DB.XYZ; The direction of extrusion, with its length the length of the extrusion. The direction must be perpendicular to the plane determined by profile. The length of vector must be non-zero.

 

RTFM, my friend.

 

Saves you a subtransaction as well.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

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

Post to forums  

Autodesk Design & Make Report