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: 

Cutting floor with void volume from family instance

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
anikakramer2006
1878 Views, 4 Replies

Cutting floor with void volume from family instance

Hi,

I know this question was asked last year and I tried the examples but still found no solution.

I tried:

http://thebuildingcoder.typepad.com/blog/2017/06/findinserts-determines-void-instances-cutting-a-flo...

http://revitapisearch.com.s3-website-us-east-1.amazonaws.com/html/ca21c6c1-7689-1a1e-f370-219eba29b8...

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.

picture01.jpg

Inside the project the family is hosted on a floor, or better said the Floor is the Work-Plane.

See picture02.

picture02.jpg

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:

picture03.jpg

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

 

4 REPLIES 4
Message 2 of 5
JimJia
in reply to: anikakramer2006

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

 

 


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
Message 3 of 5
anikakramer2006
in reply to: JimJia

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.RevitToolSimpleDialog.jpg

Message 4 of 5
JimJia
in reply to: anikakramer2006

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();
            }

 


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
Message 5 of 5
anikakramer2006
in reply to: JimJia

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.

Post to forums  

Autodesk Design & Make Report