Beispiel #1
0
        public PointMarker( Types.Point point )
        {
            if( point == null )
            {
                throw new ArgumentNullException( "point" );
            }

            _point = point;
        }
Beispiel #2
0
        public static async Task <Types.Point[]> ReadPoints(this Stream stream, int count)
        {
            var res = new Types.Point[count];

            for (var i = 0; i < count; i++)
            {
                res[i] = await stream.ReadPoint();
            }

            return(res);
        }
Beispiel #3
0
        public HardShadow( Types.Point offset, Paint.Color color )
        {
            if( offset == null )
            {
                throw new ArgumentNullException( "offset" );
            }
            if( color == null )
            {
                throw new ArgumentNullException( "color" );
            }

            _offset = offset;
            _color = color;
        }
Beispiel #4
0
        public Text( string value, Types.Point point, Position alignment )
        {
            if( value == null )
            {
                throw new ArgumentNullException( "value" );
            }
            if( point == null )
            {
                throw new ArgumentNullException( "point" );
            }

            _value = value;
            _point = point;
            _alignment = alignment;
        }
        public SoftShadowModifier( Types.Point offset, double extent, Paint.Color color )
        {
            if( offset == null )
            {
                throw new ArgumentNullException( "offset" );
            }
            if( extent <= 0 )
            {
                throw new ArgumentException( "Extent must be greater than zero.", "extent" );
            }
            if( color == null )
            {
                throw new ArgumentNullException( "color" );
            }

            _offset = offset;
            _extent = extent;
            _color = color;
        }
Beispiel #6
0
        public SoftShadow( Renderers.Renderer renderer, Types.Point offset, double extent, Paint.Color color )
        {
            if( renderer == null )
            {
                throw new ArgumentNullException( "renderer" );
            }
            if( offset == null )
            {
                throw new ArgumentNullException( "offset" );
            }
            if( extent <= 0 )
            {
                throw new ArgumentException( "Extent must be greater than zero.", "extent" );
            }
            if( color == null )
            {
                throw new ArgumentNullException( "color" );
            }

            _renderer = renderer;
            _offset = offset;
            _extent = extent;
            _color = color;
        }
Beispiel #7
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            // Get Revit Environment
            UIApplication uiApp = commandData.Application;
            Document doc = uiApp.ActiveUIDocument.Document;
            UIDocument uidoc = uiApp.ActiveUIDocument;

            GrevitBuildModel c = new GrevitBuildModel(doc);
            GrevitBuildModel.Scale = 3.28084;

            System.Windows.Forms.OpenFileDialog filedialog = new System.Windows.Forms.OpenFileDialog();
            filedialog.Multiselect = false;
            if (filedialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                SketchUpNET.SketchUp skp = new SketchUpNET.SketchUp();
                if (skp.LoadModel(filedialog.FileName))
                {
                    Grevit.Types.ComponentCollection components = new ComponentCollection() { Items = new List<Component>() };

                    foreach (SketchUpNET.Instance instance in skp.Instances)
                    {
                        if (instance.Name.ToLower().Contains("wall"))
                        {
                            foreach (SketchUpNET.Surface surface in instance.Parent.Surfaces)
                            {
                                components.Items.Add(new WallProfileBased(instance.Parent.Name, instance.Parent.Name, new List<Types.Parameter>(), surface.ToGrevitOutline(instance.Transformation), "") { GID = instance.Guid });
                            }
                        }


                        if (instance.Name.ToLower().Contains("floor"))
                        {
                            foreach (SketchUpNET.Surface surface in instance.Parent.Surfaces)
                            {
                                Types.Point bottom = instance.Transformation.GetTransformed(surface.Vertices[0]).ToGrevitPoint();
                                int ctr = surface.Vertices.Count / 2;
                                Types.Point top = instance.Transformation.GetTransformed(surface.Vertices[ctr]).ToGrevitPoint();



                                components.Items.Add(new Slab()
                                {
                                    FamilyOrStyle = instance.Parent.Name,
                                    TypeOrLayer = instance.Parent.Name,
                                    parameters = new List<Types.Parameter>(),
                                    structural = true,
                                    height = 1,
                                    surface =
                                        surface.ToGrevitProfile(instance.Transformation),
                                    bottom = bottom,
                                    top = top,
                                    slope = top.z - bottom.z,
                                    GID = instance.Guid,
                                    levelbottom = "",
                                });
                            }
                        }

                        if (instance.Name.ToLower().Contains("column"))
                        {
                            Grevit.Types.Profile profile = null;
                            Grevit.Types.Point top = null;
                            Grevit.Types.Point btm = new Types.Point(instance.Transformation.X, instance.Transformation.Y, instance.Transformation.Z);

                            foreach (SketchUpNET.Surface surface in instance.Parent.Surfaces)
                            {

                                if (surface.Normal.Z == 1)
                                {
                                    top = new Types.Point(instance.Transformation.X, instance.Transformation.Y,
                                        surface.Vertices[0].ToGrevitPoint(instance.Transformation).z);
                                }

                            }

                            components.Items.Add(new Grevit.Types.Column(instance.Parent.Name, instance.Parent.Name, new List<Types.Parameter>(), btm, top, "", true)
                            {
                                GID = instance.Guid
                            });
                        }



                    }

                    c.BuildModel(components);

                }

            }



            // Return Success
            return Result.Succeeded;
        }
 public PointDto(Types.Point point)
 {
     X = point.x;
     Y = new ComplexDto(point.y);
 }
Beispiel #9
0
        public static ComponentCollection Translate(string filename)
        {
            SketchUpNET.SketchUp skp = new SketchUpNET.SketchUp();
            if (skp.LoadModel(filename))
            {
                Grevit.Types.ComponentCollection components = new ComponentCollection()
                {
                    Items = new List <Component>()
                };
                components.scale  = 3.28084;
                components.update = true;
                components.delete = false;

                foreach (SketchUpNET.Instance instance in skp.Instances)
                {
                    SketchUpNET.Transform transform = instance.Transformation;
                    transform.Data[12] /= 39.3701;
                    transform.Data[13] /= 39.3701;
                    transform.Data[14] /= 39.3701;

                    string elementType = instance.Parent.Name.ToLower();
                    string family      = instance.Parent.Name;
                    string type        = instance.Parent.Name;

                    if (instance.Parent.Description.Contains(";"))
                    {
                        string[] data = instance.Parent.Description.Split(';');
                        family = data[0];
                        type   = data[1];
                    }

                    if (elementType.Contains("wall"))
                    {
                        foreach (SketchUpNET.Surface surface in instance.Parent.Surfaces)
                        {
                            components.Items.Add(new WallProfileBased(family, type, new List <Types.Parameter>(), surface.ToGrevitOutline(transform), "")
                            {
                                GID = instance.Guid
                            });
                        }
                    }
                    else if (elementType.Contains("grid"))
                    {
                        foreach (SketchUpNET.Edge edge in instance.Parent.Edges)
                        {
                            components.Items.Add(new Grid(new List <Types.Parameter>(), edge.Start.ToGrevitPoint(transform), edge.End.ToGrevitPoint(transform), instance.Parent.Name)
                            {
                                GID = instance.Guid
                            });
                        }
                    }
                    else if (elementType.Contains("line"))
                    {
                        foreach (SketchUpNET.Edge edge in instance.Parent.Edges)
                        {
                            components.Items.Add(new RevitLine()
                            {
                                curve = edge.ToGrevitLine(transform), isModelCurve = true, isDetailCurve = false, isRoomBounding = false, parameters = new List <Parameter>(), GID = instance.Guid, FamilyOrStyle = family, TypeOrLayer = type
                            });
                        }
                    }
                    else if (elementType.Contains("floor"))
                    {
                        foreach (SketchUpNET.Surface surface in instance.Parent.Surfaces)
                        {
                            Types.Point bottom = transform.GetTransformed(surface.Vertices[0]).ToGrevitPoint();
                            int         ctr    = surface.Vertices.Count / 2;
                            Types.Point top    = transform.GetTransformed(surface.Vertices[ctr]).ToGrevitPoint();



                            components.Items.Add(new Slab()
                            {
                                FamilyOrStyle = family,
                                TypeOrLayer   = type,
                                parameters    = new List <Types.Parameter>(),
                                structural    = true,
                                height        = 1,
                                surface       =
                                    surface.ToGrevitProfile(transform),
                                bottom      = bottom,
                                top         = top,
                                slope       = top.z - bottom.z,
                                GID         = instance.Guid,
                                levelbottom = "",
                            });
                        }
                    }
                    else if (elementType.Contains("column"))
                    {
                        Grevit.Types.Profile profile = null;
                        Grevit.Types.Point   top     = null;
                        SketchUpNET.Vertex   v       = new SketchUpNET.Vertex(0, 0, 0);
                        Grevit.Types.Point   btm     = v.ToGrevitPoint(transform);

                        foreach (SketchUpNET.Surface surface in instance.Parent.Surfaces)
                        {
                            if (surface.Normal.Z == 1)
                            {
                                top = new Types.Point(v.ToGrevitPoint(transform).x, v.ToGrevitPoint(transform).y,
                                                      surface.Vertices[0].ToGrevitPoint(transform).z);
                            }
                        }

                        components.Items.Add(new Grevit.Types.Column(family, type, new List <Types.Parameter>(), btm, top, "", true)
                        {
                            GID = instance.Guid
                        });
                    }
                }

                return(components);
            }
            return(null);
        }
Beispiel #10
0
        public RadialGradientBrush( Color innerColor, Color outerColor, Types.Point innerPoint, Types.Point outerPoint )
        {
            if( innerColor == null )
            {
                throw new ArgumentNullException( "innerColor" );
            }
            if( outerColor == null )
            {
                throw new ArgumentNullException( "outerColor" );
            }
            if( innerPoint == null )
            {
                throw new ArgumentNullException( "innerPoint" );
            }
            if( outerPoint == null )
            {
                throw new ArgumentNullException( "outerPoint" );
            }

            _innerColor = innerColor;
            _outerColor = outerColor;
            _innerPoint = innerPoint;
            _outerPoint = outerPoint;
        }
Beispiel #11
0
        public static async Task Write(this Stream stream, Types.Point point)
        {
            await stream.Write(point.Latitude);

            await stream.Write(point.Longitude);
        }
Beispiel #12
0
 public static string ToWkt(this Types.Point point, (ConvertTypes type, char?zoneLetter, int?zoneNumber)?convert = null)
Beispiel #13
0
            public override void VisitMove( Primitives.Path.Move move )
            {
                _pos = move.To;
                _estartpos = _epos = null;
                _startpos = _lastpos = _pos;
                _startev = null;

                _innerPath.Add( new Primitives.Path.Move( move.To ) );
            }
Beispiel #14
0
            public override void VisitLine( Primitives.Path.Line line )
            {
                Types.Vector lv = line.To - _lastpos;
                Types.Vector ev = new Types.Vector( lv.Y, -lv.X ).Normalize( _softShadow._extent );

                if( _epos != null )
                {
                    CreateFiller( ev );
                }

                Primitives.Path part = new BinaryComponents.VectorGraphics.Primitives.Path();

                part.Add( new Primitives.Path.Move( _lastpos + ev ) );
                part.Add( new Primitives.Path.Line( line.To + ev ) );
                part.Add( new Primitives.Path.Line( line.To ) );
                part.Add( new Primitives.Path.Line( _lastpos ) );
                part.Add( new Primitives.Path.Line( _lastpos + ev ) );
                part.Add( new Primitives.Path.Close() );

                part.Pen = null;

                Types.Point gstart = line.To, gend = line.To + ev;

                part.Brush = new Paint.Brushes.LinearGradientBrush
                    ( _softShadow._color, Paint.Color.Transparent, gstart, gend, Paint.Brushes.LinearGradientBrush.RenderHint.NoClip );

                _parts.Add( part );

                if( _estartpos == null )
                {
                    _estartpos = _pos + ev;
                }
                if( _startev == null )
                {
                    _startev = ev;
                }

                _lastpos = _pos = line.To;
                _epos = _pos + ev;

                _innerPath.Add( new Primitives.Path.Line( line.To ) );
            }
Beispiel #15
0
            public SmoothBezierCurve( Types.Point c2, Types.Point to )
            {
                if( c2 == null )
                {
                    throw new ArgumentNullException( "c2" );
                }
                if( to == null )
                {
                    throw new ArgumentNullException( "to" );
                }

                _c2 = c2;
                _to = to;
            }
Beispiel #16
0
            public Move( Types.Point to )
            {
                if( to == null )
                {
                    throw new ArgumentNullException( "to" );
                }

                _to = to;
            }
Beispiel #17
0
            public EllipticalArc( double rx, double ry, double xAxisRotation, bool largeArcFlag, bool sweepFlag, Types.Point to )
            {
                if( to == null )
                {
                    throw new ArgumentNullException( "to" );
                }

                _rx = rx;
                _ry = ry;
                _xAxisRotation = xAxisRotation;
                _largeArcFlag = largeArcFlag;
                _sweepFlag = sweepFlag;
                _to = to;
            }
Beispiel #18
0
        public LinearGradientBrush( Color startColor, Color endColor, Types.Point startPoint, Types.Point endPoint, RenderHint renderHint, params KeyValuePair<double, Color>[] intermediateColors )
        {
            if( startColor == null )
            {
                throw new ArgumentNullException( "startColor" );
            }
            if( endColor == null )
            {
                throw new ArgumentNullException( "endColor" );
            }
            if( startPoint == null )
            {
                throw new ArgumentNullException( "startPoint" );
            }
            if( endPoint == null )
            {
                throw new ArgumentNullException( "endPoint" );
            }
            if( intermediateColors == null )
            {
                throw new ArgumentNullException( "intermediateColors" );
            }

            foreach( KeyValuePair<double, Color> kvp in intermediateColors )
            {
                if( kvp.Key < 0 || kvp.Key > 1 )
                {
                    throw new ArgumentException( "Intermediate color position out-of-range.", "intermediateColors" );
                }
            }

            _startColor = startColor;
            _endColor = endColor;
            _startPoint = startPoint;
            _endPoint = endPoint;
            _renderHint = renderHint;
            _intermediateColors = intermediateColors;
        }