예제 #1
0
        Stream(ArrayList data, RebarShapeDefinition rebarShapeDef)
        {
            data.Add(new Snoop.Data.ClassSeparator(typeof(RebarShapeDefinition)));

            data.Add(new Snoop.Data.Bool("Complete", rebarShapeDef.Complete)); // TBD: should be "IsComplete?"
            data.Add(new Snoop.Data.Bool("IsPlanar", rebarShapeDef.IsPlanar));

            // Get Parameters
            data.Add(new Snoop.Data.CategorySeparator("RebarShape Definition Segments"));
            data.Add(new Snoop.Data.Enumerable("Parameters", rebarShapeDef.GetParameters()));

            RebarShapeDefinitionByArc rebarShapeDefByArc = rebarShapeDef as RebarShapeDefinitionByArc;

            if (rebarShapeDefByArc != null)
            {
                Stream(data, rebarShapeDefByArc);
                return;
            }

            RebarShapeDefinitionBySegments rebarShapeDefBySegs = rebarShapeDef as RebarShapeDefinitionBySegments;

            if (rebarShapeDefBySegs != null)
            {
                Stream(data, rebarShapeDefBySegs);
                return;
            }
        }
예제 #2
0
        Stream(ArrayList data, RebarShapeDefinitionBySegments rebarShapeDefBySegs)
        {
            data.Add(new Snoop.Data.ClassSeparator(typeof(RebarShapeDefinitionBySegments)));

            data.Add(new Snoop.Data.Int("Number of segments", rebarShapeDefBySegs.NumberOfSegments));

            // Get segments
            data.Add(new Snoop.Data.CategorySeparator("Segments"));
            for (int i = 0; i < rebarShapeDefBySegs.NumberOfSegments; i++)
            {
                data.Add(new Snoop.Data.Object("Segment " + i.ToString(), rebarShapeDefBySegs.GetSegment(i)));
            }
        }
예제 #3
0
        Stream(ArrayList data, RebarShapeDefinition rebarShapeDef)
        {
            data.Add(new Snoop.Data.ClassSeparator(typeof(RebarShapeDefinition)));

            data.Add(new Snoop.Data.Bool("Complete", rebarShapeDef.Complete)); // TBD: should be "IsComplete?"

            RebarShapeDefinitionByArc rebarShapeDefByArc = rebarShapeDef as RebarShapeDefinitionByArc;

            if (rebarShapeDefByArc != null)
            {
                Stream(data, rebarShapeDefByArc);
                return;
            }

            RebarShapeDefinitionBySegments rebarShapeDefBySegs = rebarShapeDef as RebarShapeDefinitionBySegments;

            if (rebarShapeDefBySegs != null)
            {
                Stream(data, rebarShapeDefBySegs);
                return;
            }
        }
예제 #4
0
        /// <summary>
        /// Create the multi-planar Rebar Shape according to the trapezoid wire-frame.
        /// </summary>
        /// <param name="revitDoc">Revit DB Document</param>
        /// /// <param name="bendDiameter">OutOfPlaneBendDiameter for multi-planar shape</param>
        /// <returns>Created multi-planar Rebar Shape</returns>
        public RebarShape ConstructMultiplanarRebarShape(Document revitDoc, double bendDiameter)
        {
            // Construct a segment definition with 2 lines.
            RebarShapeDefinitionBySegments shapedef = new RebarShapeDefinitionBySegments(revitDoc, 2);

            // Define parameters for the dimension.
            ElementId B  = SharedParameterUtil.GetOrCreateDef("B", revitDoc);
            ElementId H  = SharedParameterUtil.GetOrCreateDef("H", revitDoc);
            ElementId K  = SharedParameterUtil.GetOrCreateDef("K", revitDoc);
            ElementId MM = SharedParameterUtil.GetOrCreateDef("MM", revitDoc);


            // Set parameters default values according to the size Trapezoid shape.
            shapedef.AddParameter(B, Top.Length);
            shapedef.AddParameter(H, Bottom.Length - Top.Length);
            shapedef.AddParameter(K, Vertical.Length);
            shapedef.AddParameter(MM, 15);

            // Rebar shape geometry curves consist of Line S0 and Line S1.
            //
            //
            //         |Y       V1
            //         |--S0(B)--\ 
            //         |          \S1(H, K)
            //         |           \
            //---------|O-----------\----X
            //         |

            // Define Segment 0 (S0)
            //
            // S0's direction is fixed in positive X Axis.
            shapedef.SetSegmentFixedDirection(0, 1, 0);
            // S0's length is determined by parameter B
            shapedef.AddConstraintParallelToSegment(0, B, false, false);

            // Define Segment 1 (S1)
            //
            // Fix S1's direction.
            shapedef.SetSegmentFixedDirection(1, Bottom.Length - Top.Length, -Vertical.Length);
            // S1's length in positive X Axis is parameter H.
            shapedef.AddConstraintToSegment(1, H, 1, 0, 1, false, false);
            // S1's length in negative Y Axis is parameter K.
            shapedef.AddConstraintToSegment(1, K, 0, -1, 1, false, false);

            // Define Vertex 1 (V1)
            //
            // S1 at V1 is turn to right and the angle is acute.
            shapedef.AddBendDefaultRadius(1, RebarShapeVertexTurn.Right, RebarShapeBendAngle.Acute);

            // Check to see if it's full constrained.
            if (!shapedef.Complete)
            {
                throw new Exception("Shape was not completed.");
            }

            // Try to solve it to make sure the shape can be resolved with default parameter value.
            if (!shapedef.CheckDefaultParameterValues(0, 0))
            {
                throw new Exception("Can't resolve rebar shape.");
            }

            // Define multi-planar definition
            RebarShapeMultiplanarDefinition multiPlanarDef = new RebarShapeMultiplanarDefinition(bendDiameter);

            multiPlanarDef.DepthParamId = MM;

            // Realize the Rebar shape with creation static method.
            // The RebarStype is stirrupTie, and it will attach to the top cover.
            RebarShape newshape = RebarShape.Create(revitDoc, shapedef, multiPlanarDef,
                                                    RebarStyle.StirrupTie, StirrupTieAttachmentType.InteriorFace,
                                                    0, RebarHookOrientation.Left, 0, RebarHookOrientation.Left, 0);

            // Give a readable name
            newshape.Name = "API Corbel Multi-Shape " + newshape.Id;

            // Make sure we can see the created shape from the browser.
            IList <Curve> curvesForBrowser = newshape.GetCurvesForBrowser();

            if (curvesForBrowser.Count == 0)
            {
                throw new Exception("The Rebar shape is invisible in browser.");
            }

            return(newshape);
        }
예제 #5
0
        private void Stream(ArrayList data, RebarShapeDefinitionBySegments rebarShapeDefBySegs)
        {
            data.Add(new Snoop.Data.ClassSeparator(typeof(RebarShapeDefinitionBySegments)));

             data.Add(new Snoop.Data.Int("Number of segments", rebarShapeDefBySegs.NumberOfSegments));
        }
예제 #6
0
        Stream(ArrayList data, RebarShapeDefinitionBySegments rebarShapeDefBySegs)
        {
            data.Add(new Snoop.Data.ClassSeparator(typeof(RebarShapeDefinitionBySegments)));

            data.Add(new Snoop.Data.Int("Number of segments", rebarShapeDefBySegs.NumberOfSegments));
        }
예제 #7
0
 public RebarShapeDefBySegment(RebarShapeDefinitionBySegments segmentShapeDef)
     : base(segmentShapeDef)
 {
 }
예제 #8
0
파일: CorbelFrame.cs 프로젝트: AMEE/revit
        /// <summary>
        /// Create the multi-planar Rebar Shape according to the trapezoid wire-frame.
        /// </summary>
        /// <param name="revitDoc">Revit DB Document</param>
        /// /// <param name="bendDiameter">OutOfPlaneBendDiameter for multi-planar shape</param>
        /// <returns>Created multi-planar Rebar Shape</returns>
        public RebarShape ConstructMultiplanarRebarShape(Document revitDoc, double bendDiameter)
        {
            // Construct a segment definition with 2 lines.
            RebarShapeDefinitionBySegments shapedef = new RebarShapeDefinitionBySegments(revitDoc, 2);

            // Define parameters for the dimension.
            ElementId B = SharedParameterUtil.GetOrCreateDef("B", revitDoc);
            ElementId H = SharedParameterUtil.GetOrCreateDef("H", revitDoc);
            ElementId K = SharedParameterUtil.GetOrCreateDef("K", revitDoc);
            ElementId MM = SharedParameterUtil.GetOrCreateDef("MM", revitDoc);

            // Set parameters default values according to the size Trapezoid shape.
            shapedef.AddParameter(B, Top.Length);
            shapedef.AddParameter(H, Bottom.Length - Top.Length);
            shapedef.AddParameter(K, Vertical.Length);
            shapedef.AddParameter(MM, 15);

            // Rebar shape geometry curves consist of Line S0 and Line S1.
            //
            //
            //         |Y       V1
            //         |--S0(B)--\
            //         |          \S1(H, K)
            //         |           \
            //---------|O-----------\----X
            //         |

            // Define Segment 0 (S0)
            //
            // S0's direction is fixed in positive X Axis.
            shapedef.SetSegmentFixedDirection(0, 1, 0);
            // S0's length is determined by parameter B
            shapedef.AddConstraintParallelToSegment(0, B, false, false);

            // Define Segment 1 (S1)
            //
            // Fix S1's direction.
            shapedef.SetSegmentFixedDirection(1, Bottom.Length - Top.Length, -Vertical.Length);
            // S1's length in positive X Axis is parameter H.
            shapedef.AddConstraintToSegment(1, H, 1, 0, 1, false, false);
            // S1's length in negative Y Axis is parameter K.
            shapedef.AddConstraintToSegment(1, K, 0, -1, 1, false, false);

            // Define Vertex 1 (V1)
            //
            // S1 at V1 is turn to right and the angle is acute.
            shapedef.AddBendDefaultRadius(1, -1, RebarShapeBendAngle.Acute);

            // Check to see if it's full constrained.
            if (!shapedef.Complete)
            {
                throw new Exception("Shape was not completed.");
            }

            // Try to solve it to make sure the shape can be resolved with default parameter value.
            if (!shapedef.CheckDefaultParameterValues(0, 0))
            {
                throw new Exception("Can't resolve rebar shape.");
            }

            // Define multi-planar definition
            RebarShapeMultiplanarDefinition multiPlanarDef = new RebarShapeMultiplanarDefinition(bendDiameter);
            multiPlanarDef.DepthParamId = MM;

            // Realize the Rebar shape with creation static method.
            // The RebarStype is stirrupTie, and it will attach to the top cover.
            RebarShape newshape = RebarShape.Create(revitDoc, shapedef, multiPlanarDef,
                RebarStyle.StirrupTie, StirrupTieAttachmentType.InteriorFace,
                0, RebarHookOrientation.Left, 0, RebarHookOrientation.Left, 0);

            // Give a readable name
            newshape.Name = "API Corbel Multi-Shape " + newshape.Id;

            // Make sure we can see the created shape from the browser.
            IList<Curve> curvesForBrowser = newshape.GetCurvesForBrowser();
            if (curvesForBrowser.Count == 0)
            {
                throw new Exception("The Rebar shape is invisible in browser.");
            }

            return newshape;
        }
예제 #9
0
 public RebarShapeDefBySegment(RebarShapeDefinitionBySegments segmentShapeDef)
     : base(segmentShapeDef)
 {
 }
예제 #10
0
        private void Stream(ArrayList data, RebarShapeDefinitionBySegments rebarShapeDefBySegs)
        {
            data.Add(new Snoop.Data.ClassSeparator(typeof(RebarShapeDefinitionBySegments)));

             data.Add(new Snoop.Data.Int("Number of segments", rebarShapeDefBySegs.NumberOfSegments));

             // Get segments
             data.Add(new Snoop.Data.CategorySeparator("Segments"));
             for (int i=0; i< rebarShapeDefBySegs.NumberOfSegments; i++)
             {
            data.Add(new Snoop.Data.Object("Segment " + i.ToString(), rebarShapeDefBySegs.GetSegment(i)));
             }
        }