Hi,
I know this question was asked last year and I tried the examples but still found no solution.
I tried:
with no luck.
As you can see in picture01 the parameter "Cut with Voids When Loaded" is yes. You can also see my void volume body inside the family.
Inside the project the family is hosted on a floor, or better said the Floor is the Work-Plane.
See picture02.
When I try:
FamilyInstance instance = _doc.Create.NewFamilyInstance(reference, location, new XYZ(0, 0, 0), symbol); Parameter parameter = instance.get_Parameter(BuiltInParameter.INSTANCE_FREE_HOST_OFFSET_PARAM); parameter.Set(-50 / 304.8); try { InstanceVoidCutUtils.AddInstanceVoidCut(_doc, floor, instance); } catch (Exception) { throw; }
I get this exception:
I've just started with Revit Programming in C#. Maybe it is just one thing what I'm missing or doing wrong. Can somebody give me a little hint.
Thanks in advance.
Annie
Solved! Go to Solution.
Solved by JimJia. Go to Solution.
Hi,
Can you provide more details about the question asked last year?
In order to explore this matter further, we will need to provide a minimal reproducible case for the development team to analyse in depth.
In order to understand exactly what you mean and be able to research possible reasons for the discrepancy between the observed and expected behaviour, they require:
· A short exact description of what you are trying to achieve.
· The behavior you observe versus what you expect, and why this is a problem.
· A complete yet minimal Revit sample model to run a test in.
· A complete yet minimal macro embedded in the sample model or Visual Studio solution with add-in manifest that can be compiled, loaded, run and debugged with a single click to analyse its behavior live in the sample model.
· Detailed step-by-step instructions for reproducing the issue, e.g. which element to pick, what command to launch etc.
· http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b
Hi,
I uploaded the VS project, the Revit project template and the family. What I want to do automatically with the Revit API I show you in the short video I also add. You can find my problem in line 266 in SimpleDialog.cs. If I want to intersect the floor with the spot, an exception is thrown. If you load the addin into your Revit environment enter a size bigger than 1500mm into the textboxes Currently I do not intercept wrong input yet. Hope I added everything you need.
Please accept our sincerer apology for the delay! We had a backlog in the queue.
Per further investigation, we didn't find code problem, however the code can be refined to solve your problem.
In your code, you want cut elements immeditately after creating floor and family instance, the potential issue here is: the geometry of elements may not be regenerated successfully yet, so the element cut will fail.
I tried to refine your code: firstly, create floor, familyinstance in one transaction firstly, and then cut elements in another separated transaction, the code can work now, no exception will be threw, the cutting will happen successfully; see code snippet example below(I also attached the updated .cs file), FYI:
// create family instance in one transaction firstl to ensure the create happens successfully. using (Transaction tr = new Transaction(_doc)) { tr.Start("Create Steambath"); CreateSteambathStandard(); tr.Commit(); } // // delay the cut after creation to ensure element geomtry build successfully. using (Transaction tr = new Transaction(_doc)) { tr.Start("Cut element"); CutElements(); tr.Commit(); }
Hi,
thanks for your response!
I have created a list with all family instances I want to cut with the floor
inside the transaction.
I gave it a quick try and jupp, total happy, it worked!
Good start into the new week.
Thanks.
Can't find what you're looking for? Ask the community or share your knowledge.