« Views Displaying Given Element, SVG and NoSQL | Main | TessellateSolidOrShell Holes Versus Wholes »

May 21, 2014

Comments

Hi Jeremy,
I have met a problem when creating a sweep in Revit that the size of sweep object created by codes can not be stretched,my codes is:
Sweep sweep1 =m_familyDocument.FamilyCreate.NewSweep(true, curves, sketchPlane, profile, 0, ProfilePlaneLocation.Start);
So I think add a dimension will address the question.Before adding a dimension I should create corresponding referenceplan in front(south)elevation,here comes the problem: How can I create referenceplane in front(south)elevation??I can find front(south)elevation with codes
http://spiderinnet.typepad.com/blog/2012/10/revit-api-coding-good-practice-filter-elevations-with-class-type-and-directions-instead-of-names.html
then I use the following codes add referenceplane
void addReferencePlanes()
{
//
double PH = mmToFeet(800.0);
double WW = mmToFeet(400.0);
double CW = mmToFeet(600.0);
double BW = mmToFeet(1600);
double BT = mmToFeet(400);

//
//
IEnumerable eastElevations = FindElevations.Find(_doc, FindElevations.Direction.South, false);
View viewplan = eastElevations.First() as View;
if(viewplan!=null)
TaskDialog.Show("eastElevations", viewplan.Name.ToString());
XYZ source = new XYZ(-4.3, 4.7, 1.7);
XYZ target = new XYZ(4.3, 4.7, 1.7);
ReferencePlane refFront = _doc.FamilyCreate.NewReferencePlane(source, target, XYZ.BasisZ, viewplan);
refFront.Name = "Center";
if(refFront==null)
TaskDialog.Show("Wrong", "ReferencePlane is null");
// get the bubble and free ends from front ref plane and offset by td.
//
XYZ p1 = refFront.BubbleEnd;
TaskDialog.Show("refFront.BubbleEnd", p1.ToString());
XYZ p2 = refFront.FreeEnd;
TaskDialog.Show("refFront.FreeEnd", p2.ToString());
XYZ HDownBubbleEnd = new XYZ(p1.X, p1.Y -BT, p1.Z);
XYZ HDownFreeEnd = new XYZ(p2.X, p2.Y -BT, p2.Z);

//
ReferencePlane refPlane = _doc.FamilyCreate.NewReferencePlane(HDownBubbleEnd, HDownFreeEnd, XYZ.BasisZ, viewplan);
refPlane.Name = "OffsetHDown";

HDownBubbleEnd = new XYZ(p1.X, p1.Y +PH, p1.Z);
HDownFreeEnd = new XYZ(p2.X, p2.Y +PH, p2.Z);
refPlane = _doc.FamilyCreate.NewReferencePlane(HDownBubbleEnd, HDownFreeEnd, XYZ.BasisZ, viewplan);
refPlane.Name = "OffsetHUp";
//
//

ReferencePlane refLeft = findElement(typeof(ReferencePlane), "中心(左/右)") as ReferencePlane;
//
p1 = refLeft.BubbleEnd;
//TaskDialog.Show("refLeft.BubbleEnd", p1.ToString());
p2 = refLeft.FreeEnd;
//TaskDialog.Show("refLeft.BubbleEnd", p2.ToString());
XYZ VLeftBubbleEnd = new XYZ(p1.X -WW-CW, p1.Y, p1.Z);
XYZ VLeftFreeEnd = new XYZ(p2.X - WW - CW, p2.Y, p2.Z);

//
refPlane = _doc.FamilyCreate.NewReferencePlane(VLeftBubbleEnd, VLeftFreeEnd, XYZ.BasisZ, viewplan);
refPlane.Name = "OffsetVLeft2";

VLeftBubbleEnd = new XYZ(p1.X - WW, p1.Y, p1.Z);
VLeftFreeEnd = new XYZ(p2.X - WW, p2.Y, p2.Z);
refPlane = _doc.FamilyCreate.NewReferencePlane(VLeftBubbleEnd, VLeftFreeEnd, XYZ.BasisZ, viewplan);
refPlane.Name = "OffsetVLeft1";
VLeftBubbleEnd = new XYZ(p1.X +BW-CW- WW, p1.Y, p1.Z);
VLeftFreeEnd = new XYZ(p2.X +BW-CW- WW, p2.Y, p2.Z);
refPlane = _doc.FamilyCreate.NewReferencePlane(VLeftBubbleEnd, VLeftFreeEnd, XYZ.BasisZ, viewplan);
refPlane.Name = "OffsetVRight";

}
Only in FloorView can see the adding six referenceplanes,in front(sourth) Elevation View can see the OffsetVLeft2,OffsetVLeft1,OffsetVRight referenceplane,how can I address this problem,I just want to create a sweep with dimensions consulting RvtCmd_FamilyCreateColumnLShape.cs(http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=2484975)Revit 2014 API Labs.

Dear Ariel,

The Family API labs demonstrate retrieving references and adding constraints to all six faces of a simple rectangular column, and even more to the L shaped column.

The most recent version was just uploaded to GitHub:

https://github.com/ADN-DevTech/RevitTrainingMaterial

The references are obtained and constraints added in the method addAlignments in the module 2_ColumnLshape.cs:

https://github.com/ADN-DevTech/RevitTrainingMaterial/blob/master/Labs/3_Revit_Family_API/SourceCS/2_ColumnLshape.cs

Does that achieve what you are seeking?

Cheers, Jeremy.

Dear Jeremy,
Thank you for your replying,during coding I find sweep is quite different from extrusion.I just imitating the document you recommend before to building my own sweep.Now I can creating a sweep in revit,and adding alignments,adding parameters,adding dimensions,all these are realized,however,when I want to change the parameter,the model does not follow the change and the result is mistake. I add reference planes in front elevation with coding,but in the front elevation of revit,all the reference planes I created are grey and can not be edited,So I think this is the key of the problem,but I can not address it.

When creating a sweep in revit we should first draw a sweeppath,and then choose to switch to front or back elevation.In my code I just add reference plans in front elevation and leaving the choosing process.Is this the major problem??
Cheers,Ariel

How do you add vA3C in as a plugin for Revit? I downloaded the files from: https://va3c.github.io/

Then added them to my plugins directory, no export button shows up. What am I doing wrong?

Dear Matt,

All Revit add-ins are installed the same way: place the add-in manifest in a specific folder that Revit looks at and loads.

The add-in manifest with the filename extension *.addin specifies the location of the .NET assembly DLL.

For a simple add-in, I specify no path, just the DLL name, and place it in the same folder.

If you simply compile the add-in in Visual Studio, it will copy the add-in manifest and DLL to the right location for you automatically, due to special post-build events that are set up to do that.

For more info, look at the Revit API getting started material:

http://thebuildingcoder.typepad.com/blog/about-the-author.html#2

Cheers, Jeremy.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Your Information

(Name and email address are required. Email address will not be displayed with the comment.)

Jeremy Tammik

AboutTopicsIndexSource