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();
}
}
Solved! Go to Solution.
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();
}
}
Solved! Go to Solution.
Solved by jeremytammik. Go to 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
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
Can't find what you're looking for? Ask the community or share your knowledge.