Tu sei qui

blog di StefanoGuarnieri

Bridge_Of_The_Peace

Inspired by Michele De Lucchi's project in Tbilisi

 

public IExternalCommand.Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            Application app = commandData.Application;
            Document doc = app.ActiveDocument;
            double n = 80;
 
            ReferencePointArray points1 = new ReferencePointArray();
            ReferencePointArray points2 = new ReferencePointArray();
            
            for(double i=1;i<n;i= i+1)
            {               
                    double t = i / n;              
                    double radius = 60;
                    XYZ coordDX = app.Create.NewXYZ(6 * radius * Math.Cos(Math.PI * t), radius * Math.Sin(Math.PI * t),40 * Math.Cos(4 * Math.PI * t));
                    ReferencePoint pointRefDX = doc.FamilyCreate.NewReferencePoint(coordDX);                   
                    points1.Append(pointRefDX);
 
                    XYZ coordSX = app.Create.NewXYZ(6 * radius * Math.Cos(-Math.PI * t), radius * Math.Sin(-Math.PI * t), 40 * Math.Cos(4 * Math.PI * t));
                    ReferencePoint pointRefSX = doc.FamilyCreate.NewReferencePoint(coordSX);                   
                    points2.Append(pointRefSX);
                    
                    XYZ coordCenter = app.Create.NewXYZ(coordDX.X, 0.0, - 30*Math.Cos(1.5*Math.PI)+ 40+ 30 * Math.Cos(-1.5*Math.PI+3*Math.PI*t));
                                                                              
                    Arc geomArc = app.Create.NewArc(coordDX, coordSX, coordCenter);
                   
                    XYZ origin = app.Create.NewXYZ(0, 0, 0);
                    XYZ normal = app.Create.NewXYZ(1, 0, 0);
                    Plane geomPlane = app.Create.NewPlane(XYZ.BasisZ, XYZ.BasisY, coordCenter);
                   
                    SketchPlane sketch = doc.FamilyCreate.NewSketchPlane(geomPlane);
                   
                    ModelArc arc = doc.FamilyCreate.NewModelCurve(geomArc, sketch) as ModelArc;
                    
                    Reference reference = arc.GeometryCurve.Reference;
                    for (double j = 0.1; j < 1; j = j + 0.1)
                    {
                        PointOnEdge pointRef = app.Create.NewPointOnEdge(reference, j);
                        ReferencePoint referencepoint = doc.FamilyCreate.NewReferencePoint(pointRef);
                    }                                             
            }
 
            CurveByPoints firstprofile = doc.FamilyCreate.NewCurveByPoints(points1);
            CurveByPoints secondprofile = doc.FamilyCreate.NewCurveByPoints(points2);
            return IExternalCommand.Result.Succeeded;
        }

Pagine

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer