Revit secondary development creates parts

Some projects require the use of parts to divide floor tiles, such as this:
Insert image description here
Using parts can be a good way to count quantities and set paving joints and other data, so here is a method to create parts.

 PartUtils.CreateParts(doc,new List<ElementId>(){detailFloor.Id});
                
                doc.Regenerate();
                
                var elementIds = PartUtils.GetAssociatedParts(doc, detailFloor.Id, true, true);
                
                var maker =  PartUtils.DivideParts(doc, elementIds, new List<ElementId>() {  },
                    curves, ske.Id);
                
                var para = maker.get_Parameter(BuiltInParameter.PARTMAKER_PARAM_DIVISION_GAP);
                para.Set(cranny);
                
                doc.Regenerate();
  1. First you need to create the missing part
  2. Add segmentation to the part. Here the line segments do not need to check for collision or closure. You can directly calculate the value and pass in the boundary line.
  3. Find the para of the gap and set the value

Use the above three steps to complete part division and attribute settings.

Guess you like

Origin blog.csdn.net/qq_41059339/article/details/130581898