private void CreateBoxShape(IFCImportShapeEditScope shapeEditScope, Transform scaledLcs)
        {
            using (IFCImportShapeEditScope.IFCContainingRepresentationSetter repSetter = new IFCImportShapeEditScope.IFCContainingRepresentationSetter(shapeEditScope, this))
            {
                // Get the material and graphics style based in the "Box" sub-category of Generic Models.
                // We will create the sub-category if this is our first time trying to use it.
                // Note that all bounding boxes are controlled by a sub-category of Generic Models.  We may revisit that decision later.
                // Note that we hard-wire the identifier to "Box" because older files may have bounding box items in an obsolete representation.
                SolidOptions solidOptions = null;
                Category     bboxCategory = IFCCategoryUtil.GetSubCategoryForRepresentation(shapeEditScope.Document, Id, IFCRepresentationIdentifier.Box);
                if (bboxCategory != null)
                {
                    ElementId     materialId    = (bboxCategory.Material == null) ? ElementId.InvalidElementId : bboxCategory.Material.Id;
                    GraphicsStyle graphicsStyle = bboxCategory.GetGraphicsStyle(GraphicsStyleType.Projection);
                    ElementId     gstyleId      = (graphicsStyle == null) ? ElementId.InvalidElementId : graphicsStyle.Id;
                    solidOptions = new SolidOptions(materialId, gstyleId);
                }

                Solid bboxSolid = IFCGeometryUtil.CreateSolidFromBoundingBox(scaledLcs, BoundingBox, solidOptions);
                if (bboxSolid != null)
                {
                    IFCSolidInfo bboxSolidInfo = IFCSolidInfo.Create(Id, bboxSolid);
                    shapeEditScope.AddGeometry(bboxSolidInfo);
                }
            }
            return;
        }
Example #2
0
        public NewGameForm(int wid, int hei, int bom, GraphicsStyle style)
        {
            InitializeComponent();

            graphicsStyle = style;

            widthBox.Text  = wid.ToString();
            heightBox.Text = hei.ToString();
            bombsBox.Text  = bom.ToString();

            comboBox1.Items.Add("Desert");
            comboBox1.Items.Add("Icefield");
            comboBox1.Items.Add("Snowfield");
            comboBox1.Items.Add("Islands");
            comboBox1.Items.Add("Classic");
            comboBox1.Items.Add("Ocean");
            comboBox1.Items.Add("Meadow");
            comboBox1.SelectedIndex = (int)style;
            comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;

            button1.FlatStyle = FlatStyle.Flat;
            button1.FlatAppearance.BorderSize = 2;
            SetGraphics();

            this.CenterToParent();
            this.MaximizeBox = false;
            this.MinimizeBox = false;
        }
Example #3
0
        /// <summary>
        /// Create geometry for a particular representation item.
        /// </summary>
        /// <param name="shapeEditScope">The geometry creation scope.</param>
        /// <param name="lcs">Local coordinate system for the geometry.</param>
        /// <param name="scaledLcs">Local coordinate system for the geometry, including scale, potentially non-uniform.</param>
        /// <param name="guid">The guid of an element for which represntation is being created.</param>
        override protected void CreateShapeInternal(IFCImportShapeEditScope shapeEditScope, Transform lcs, Transform scaledLcs, string guid)
        {
            if (XYZPoint == null)
            {
                return;
            }

            XYZ transformedPoint = scaledLcs.OfPoint(XYZPoint);

            if (transformedPoint == null)
            {
                return;
            }

            ElementId gstyleId      = shapeEditScope.GraphicsStyleId;
            Category  pointCategory = IFCCategoryUtil.GetSubCategoryForRepresentation(shapeEditScope.Document, Id, shapeEditScope.ContainingRepresentation.Identifier);

            if (pointCategory != null)
            {
                GraphicsStyle graphicsStyle = pointCategory.GetGraphicsStyle(GraphicsStyleType.Projection);
                if (graphicsStyle != null)
                {
                    gstyleId = graphicsStyle.Id;
                }
            }

            Point point = Point.Create(transformedPoint, gstyleId);

            if (point == null)
            {
                return;
            }

            shapeEditScope.AddGeometry(IFCSolidInfo.Create(Id, point));
        }
Example #4
0
        public static Color GetBackgroundColor(GraphicsStyle graphicsStyle)
        {
            switch (graphicsStyle)
            {
            case GraphicsStyle.Desert:
                return(Color.FromArgb(255, 255, 215, 0));

            case GraphicsStyle.Icefield:
                return(Color.FromArgb(255, 255, 255, 255));

            case GraphicsStyle.Snowfield:
                return(Color.FromArgb(255, 255, 255, 255));

            case GraphicsStyle.Islands:
                return(Color.FromArgb(255, 67, 210, 249));

            case GraphicsStyle.Classic:
                return(Color.FromArgb(255, 230, 230, 230));

            case GraphicsStyle.Ocean:
                return(Color.FromArgb(255, 67, 210, 249));

            case GraphicsStyle.Meadow:
                return(Color.FromArgb(255, 158, 202, 22));

            default:
                return(Color.FromArgb(255, 255, 215, 0));
            }
        }
Example #5
0
        /// <summary>
        /// 通过字符串寻找目标线样式
        /// </summary>
        public static GraphicsStyle GetGraphicsStyleByName(this Document doc, string lineStyleName)
        {
            List <GraphicsStyle> graphicsStyles = GetAllLineStyleIdsFromSetting(doc);
            GraphicsStyle        graphicsStyle  = null;

            foreach (var item in graphicsStyles)
            {
                if (item.Name == lineStyleName)
                {
                    graphicsStyle = item;
                    break;
                }
            }
            if (graphicsStyle == null)
            {
                foreach (var item in graphicsStyles)
                {
                    if (item.Name == "细线")
                    {
                        graphicsStyle = item;
                        break;
                    }
                }
            }
            return(graphicsStyle);
        }
Example #6
0
        public static Bitmap GetAllImages(GraphicsStyle graphicsStyle)
        {
            switch (graphicsStyle)
            {
            case GraphicsStyle.Desert:
                return(new Bitmap(Properties.Resources.desert));

            case GraphicsStyle.Icefield:
                return(new Bitmap(Properties.Resources.icefield));

            case GraphicsStyle.Snowfield:
                return(new Bitmap(Properties.Resources.snowfield));

            case GraphicsStyle.Islands:
                return(new Bitmap(Properties.Resources.islands));

            case GraphicsStyle.Classic:
                return(new Bitmap(Properties.Resources.classic));

            case GraphicsStyle.Ocean:
                return(new Bitmap(Properties.Resources.ocean));

            case GraphicsStyle.Meadow:
                return(new Bitmap(Properties.Resources.meadow));

            default:
                return(new Bitmap(Properties.Resources.desert));
            }
        }
Example #7
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiapp     = commandData.Application;
            UIDocument    uidoc     = uiapp.ActiveUIDocument;
            Document      doc       = uidoc.Document;
            Selection     selection = uidoc.Selection;

            Reference      reff           = selection.PickObject(ObjectType.PointOnElement);
            Element        elem           = doc.GetElement(reff);
            GeometryObject obj            = elem.GetGeometryObjectFromReference(reff);
            Category       targetCategory = null;

            if (obj.GraphicsStyleId != ElementId.InvalidElementId)
            {
                GraphicsStyle gs = doc.GetElement(obj.GraphicsStyleId) as GraphicsStyle;
                if (gs != null)
                {
                    targetCategory = gs.Category;
                }
            }
            using (Transaction ts = new Transaction(doc, "hide selected cad layer"))
            {
                ts.Start();
                doc.ActiveView.SetVisibility(targetCategory, false);
                ts.Commit();
            }

            return(Result.Succeeded);
        }
Example #8
0
        public static Color GetButtonColor(GraphicsStyle graphicsStyle)
        {
            switch (graphicsStyle)
            {
            case GraphicsStyle.Desert:
                return(Color.FromArgb(255, 255, 215, 0));

            case GraphicsStyle.Icefield:
                return(Color.FromArgb(255, 153, 217, 234));

            case GraphicsStyle.Snowfield:
                return(Color.FromArgb(255, 255, 255, 255));

            case GraphicsStyle.Islands:
                return(Color.FromArgb(255, 60, 188, 223));

            case GraphicsStyle.Classic:
                return(Color.FromArgb(255, 200, 200, 200));

            case GraphicsStyle.Ocean:
                return(Color.FromArgb(255, 60, 188, 223));

            case GraphicsStyle.Meadow:
                return(Color.FromArgb(255, 158, 202, 22));

            default:
                return(Color.FromArgb(255, 255, 215, 0));
            }
        }
Example #9
0
        public static Color GetEdgeColor(GraphicsStyle graphicsStyle)
        {
            switch (graphicsStyle)
            {
            case GraphicsStyle.Desert:
                return(Color.FromArgb(255, 255, 140, 0));

            case GraphicsStyle.Icefield:
                return(Color.FromArgb(255, 0, 162, 232));

            case GraphicsStyle.Snowfield:
                return(Color.FromArgb(255, 163, 224, 239));

            case GraphicsStyle.Islands:
                return(Color.FromArgb(255, 56, 175, 208));

            case GraphicsStyle.Classic:
                return(Color.FromArgb(255, 150, 150, 150));

            case GraphicsStyle.Ocean:
                return(Color.FromArgb(255, 56, 175, 208));

            case GraphicsStyle.Meadow:
                return(Color.FromArgb(255, 127, 163, 18));

            default:
                return(Color.FromArgb(255, 255, 140, 0));
            }
        }
Example #10
0
        public static Icon GetIcon(GraphicsStyle graphicsStyle)
        {
            switch (graphicsStyle)
            {
            case GraphicsStyle.Desert:
                return(Properties.Resources.icon_0);

            case GraphicsStyle.Icefield:
                return(Properties.Resources.icon_1);

            case GraphicsStyle.Snowfield:
                return(Properties.Resources.icon_2);

            case GraphicsStyle.Islands:
                return(Properties.Resources.icon_3);

            case GraphicsStyle.Classic:
                return(Properties.Resources.icon_4);

            case GraphicsStyle.Ocean:
                return(Properties.Resources.icon_5);

            case GraphicsStyle.Meadow:
                return(Properties.Resources.icon_6);

            default:
                return(Properties.Resources.icon_0);
            }
        }
Example #11
0
        private void ChangeGraphicsStyle(GraphicsStyle style)
        {
            graphicsStyle = style;


            Bitmap allImages = GraphicsController.GetAllImages(graphicsStyle);

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    gameGraphics[4 * i + j] = allImages.Clone(new Rectangle(j * FIELD_SIZE, i * FIELD_SIZE, FIELD_SIZE, FIELD_SIZE), allImages.PixelFormat);
                }
            }

            this.Text               = GraphicsController.GetTitle(graphicsStyle);
            this.Icon               = GraphicsController.GetIcon(graphicsStyle);
            this.BackgroundImage    = GraphicsController.GetBackground(graphicsStyle, FIELD_SIZE);
            this.BackColor          = GraphicsController.GetBackgroundColor(graphicsStyle);
            this.BackgroundImage    = gameGraphics[0];
            newGameButton.BackColor = GraphicsController.GetButtonColor(graphicsStyle);
            newGameButton.FlatAppearance.BorderColor = GraphicsController.GetEdgeColor(graphicsStyle);
            restartButton.BackColor = GraphicsController.GetButtonColor(graphicsStyle);
            restartButton.FlatAppearance.BorderColor = GraphicsController.GetEdgeColor(graphicsStyle);
        }
Example #12
0
 private void lineCiz(List <XYZ> vertexList)
 {
     try
     {
         if (vertexList.Count > 1)
         {
             for (int i = 0; i < vertexList.Count - 1; i++)
             {
                 XYZ v1     = vertexList[i];
                 XYZ v2     = vertexList[i + 1];
                 XYZ normal = new XYZ(0, 0, 1);
                 using (Transaction tr = new Transaction(doc, "Yüzey Çiz"))
                 {
                     tr.Start();
                     Plane         plane       = Plane.CreateByNormalAndOrigin(normal, v1);
                     SketchPlane   sketchPlane = SketchPlane.Create(doc, plane);
                     Line          line        = Line.CreateBound(vertexList[i], vertexList[i + 1]);
                     ModelCurve    ml          = doc.Create.NewModelCurve(line, sketchPlane);
                     GraphicsStyle gs          = ml.LineStyle as GraphicsStyle;
                     gs.GraphicsStyleCategory.LineColor = new Autodesk.Revit.DB.Color(255, 10, 10);
                     tr.Commit();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Example #13
0
        public NewGameInputError(int errorID, GraphicsStyle style)
        {
            InitializeComponent();

            graphicsStyle     = style;
            button1.FlatStyle = FlatStyle.Flat;
            button1.FlatAppearance.BorderSize = 2;

            this.CenterToParent();
            this.MaximizeBox = false;
            this.MinimizeBox = false;

            if (errorID == 1)
            {
                label3.Text = "Check field with width.";
                label4.Text = "Only numbers between 2 and 150 allowed.";
            }
            if (errorID == 2)
            {
                label3.Text = "Check field with height.";
                label4.Text = "Only numbers between 2 and 100 allowed.";
            }
            if (errorID == 3)
            {
                label3.Text = "Check field with number of bombs.";
                label4.Text = "Only numbers between 1 and (area-2).";
            }
            SetGraphics();
        }
Example #14
0
        /***************************************************/

        public static IBHoMObject FromRevit(this GraphicsStyle graphicStyle, Discipline discipline, Transform transform = null, RevitSettings settings = null, Dictionary <string, List <IBHoMObject> > refObjects = null)
        {
            switch (discipline)
            {
            default:
                return(graphicStyle.InstancePropertiesFromRevit(settings, refObjects));
            }
        }
Example #15
0
 public EntityType(Trajectory t, Drawable draw, PhysicsShape physS, EntityClass pc, BulletEmitter e = null, GraphicsStyle g = null)
 {
     traj         = t;
     this.draw    = draw;
     this.bounds  = physS;
     this.myClass = pc;
     emitter      = e;
     gs           = g;
 }
Example #16
0
        /// <summary>
        /// Draw point marker with detail circles.
        /// Optional colors are "red" "blue" "orange"
        /// </summary>
        public static void DrawDetailMarkers(Document doc, List <XYZ> pts, int weight = 2, string color = "red", string pattern = "")
        {
            GetListOfLinestyles(doc);

            View  view    = doc.ActiveView;
            Color palette = new Color(0, 0, 0);

            switch (color)
            {
            case "red": palette = new Color(200, 50, 80); break;

            case "blue": palette = new Color(100, 149, 237); break;

            case "orange": palette = new Color(255, 140, 0); break;
            }

            FilteredElementCollector fec = new FilteredElementCollector(doc)
                                           .OfClass(typeof(LinePatternElement));

            LinePatternElement linePatternElem = null;

            if (pattern != "")
            {
                try
                {
                    linePatternElem = fec
                                      .Cast <LinePatternElement>()
                                      .First <LinePatternElement>(linePattern => linePattern.Name == pattern);
                }
                catch
                {
                    Debug.Print("There's no matching pattern in the document");
                }
            }

            XYZ xAxis = new XYZ(1, 0, 0);
            XYZ yAxis = new XYZ(0, 1, 0);

            using (Transaction tx = new Transaction(doc))
            {
                tx.Start("Create Detail Markers");
                foreach (XYZ pt in pts)
                {
                    double        radius    = 0.3;
                    Arc           marker    = Arc.Create(pt, radius, 0, 2 * Math.PI, xAxis, yAxis);
                    DetailCurve   detailCrv = doc.Create.NewDetailCurve(view, marker);
                    GraphicsStyle gs        = detailCrv.LineStyle as GraphicsStyle;
                    gs.GraphicsStyleCategory.LineColor = palette;
                    gs.GraphicsStyleCategory.SetLineWeight(weight, gs.GraphicsStyleType);
                    if (linePatternElem != null)
                    {
                        gs.GraphicsStyleCategory.SetLinePatternId(linePatternElem.Id, GraphicsStyleType.Projection);
                    }
                }
                tx.Commit();
            }
        }
Example #17
0
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            Document      doc   = uiapp.ActiveUIDocument.Document;

            FilteredElementCollector collector      = new FilteredElementCollector(doc);
            List <Element>           graphicsStyles = collector.OfClass(typeof(GraphicsStyle)).ToElements().ToList();

            List <ElementId> elementsToDelete = new List <ElementId>();

            foreach (Element element in graphicsStyles)
            {
                GraphicsStyle gs = element as GraphicsStyle;
                if (null != gs.GraphicsStyleCategory)
                {
                    if (null != gs.GraphicsStyleCategory.Parent)
                    {
                        if (gs.GraphicsStyleCategory.Parent.Id.IntegerValue == (int)BuiltInCategory.OST_Lines)
                        {
                            Category category = gs.GraphicsStyleCategory;
                            if (category.Name.StartsWith("SW"))
                            {
                                elementsToDelete.Add(category.Id);
                            }
                        }
                    }
                }
            }
            int count = elementsToDelete.Count;

            if (count > 0)
            {
                using (Transaction trans = new Transaction(doc))
                {
                    trans.Start("Delete Line Styles");
                    try
                    {
                        ICollection <ElementId> deletedIds = doc.Delete(elementsToDelete);
                        trans.Commit();
                        if (deletedIds.Count > 0)
                        {
                            int deletedCount = deletedIds.Count;
                            MessageBox.Show(deletedCount.ToString() + " line styles are successfully deleted.", "Purge Line Styles");
                        }
                    }
                    catch (Exception ex)
                    {
                        string exceptionMsg = ex.Message;
                        trans.RollBack();
                    }
                }
            }


            return(Result.Succeeded);
        }
Example #18
0
        public BulletStyle MakeStyle(string s, PhysicsShape p, GraphicsStyle sty)
        {
            BulletStyle ans = (t, path, pc) =>
            {
                return(new Bullet(t, path, p.MakeDrawable(sty), p, pc, null));
            };

            savedStyles[s] = ans;
            return(ans);
        }
        /// <summary>
        /// Returns the Solid edges in the View plane.
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="s"></param>
        /// <param name="view"></param>
        /// <param name="cat"></param>
        /// <returns></returns>
        private static IList <Curve> SolidEdgesToCurve(Document doc, Solid s, View view, Category cat)
        {
            Utils.Log(string.Format("UtilsSectionView.SolidEdgesToCurve started...", ""));

            IList <Curve> curves = new List <Curve>();

            if (s.Volume <= 0)
            {
                return(curves);
            }

            Options opt = new Options();

            opt.View = view;
            opt.ComputeReferences        = true;
            opt.IncludeNonVisibleObjects = true;

            Transform tr = Transform.Identity;

            tr.Origin = view.Origin;
            tr.BasisX = view.RightDirection;
            tr.BasisY = view.UpDirection;
            tr.BasisZ = tr.BasisX.CrossProduct(tr.BasisY);

            foreach (Edge edge in s.Edges)
            {
                GraphicsStyle gse = doc.GetElement(edge.GraphicsStyleId) as GraphicsStyle;

                Curve c = edge.AsCurve();
                XYZ   p = c.Evaluate(0.5, true);

                XYZ g = tr.Inverse.OfPoint(p);

                if (Math.Abs(g.Z) < 0.00001)
                {
                    if (c is HermiteSpline)
                    {
                        var         hs  = c as HermiteSpline;
                        IList <XYZ> pts = c.Tessellate();
                        for (int i = 0; i < pts.Count - 1; ++i)
                        {
                            curves.Add(Line.CreateBound(pts[i], pts[i + 1]));
                        }
                    }
                    else
                    {
                        curves.Add(c);
                    }
                }
            }

            Utils.Log(string.Format("UtilsSectionView.SolidEdgesToCurve completed.", ""));

            return(curves);
        }
Example #20
0
        public EntityType ChangeDrawStyle(GraphicsStyle sty, bool clone = false)
        {
            EntityType ans = this;

            if (clone)
            {
                ans = new EntityType(this);
            }
            ans.DrawStyle = sty;
            return(ans);
        }
Example #21
0
        /// <summary>
        /// Draw detail curves based on List<Curve>
        /// </summary>
        public static void DrawDetailLines(Document doc, List <Curve> crvs, int weight = 2, string color = "red", string pattern = "")
        {
            GetListOfLinestyles(doc);

            View  view    = doc.ActiveView;
            Color palette = new Color(0, 0, 0);

            switch (color)
            {
            case "red": palette = new Color(200, 50, 80); break;

            case "blue": palette = new Color(100, 149, 237); break;

            case "orange": palette = new Color(255, 140, 0); break;
            }

            FilteredElementCollector fec = new FilteredElementCollector(doc)
                                           .OfClass(typeof(LinePatternElement));

            LinePatternElement linePatternElem = null;

            if (pattern != "")
            {
                try
                {
                    linePatternElem = fec
                                      .Cast <LinePatternElement>()
                                      .First <LinePatternElement>(linePattern => linePattern.Name == pattern);
                }
                catch
                {
                    Debug.Print("There's no matching pattern in the document");
                }
            }


            using (Transaction tx = new Transaction(doc))
            {
                tx.Start("Create Detail Curves");
                foreach (Curve crv in crvs)
                {
                    // Should do style setting here or...?
                    DetailCurve   detailCrv = doc.Create.NewDetailCurve(view, crv);
                    GraphicsStyle gs        = detailCrv.LineStyle as GraphicsStyle;
                    gs.GraphicsStyleCategory.LineColor = palette;
                    gs.GraphicsStyleCategory.SetLineWeight(weight, gs.GraphicsStyleType);
                    if (linePatternElem != null)
                    {
                        gs.GraphicsStyleCategory.SetLinePatternId(linePatternElem.Id, GraphicsStyleType.Projection);
                    }
                }
                tx.Commit();
            }
        }
Example #22
0
        /// <summary>
        /// 拿出所有的线型元素list 传递给combox需要GraphicsStyle的list
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public static List <GraphicsStyle> getAllLineGraphicsStyl(Document doc)
        {
            List <GraphicsStyle>    lineStyles   = new List <GraphicsStyle>();
            ICollection <ElementId> lineStyleIds = GetAllLineStyleIdsFromSetting(doc);

            foreach (ElementId _eleId in lineStyleIds)
            {
                GraphicsStyle LineSyle = doc.GetElement(_eleId) as GraphicsStyle;
                lineStyles.Add(LineSyle);
            }
            return(lineStyles);
        }
Example #23
0
        /// <summary>
        /// Create a list of geometry objects to export from an initial list of solids and meshes, excluding invisible and not exported categories.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="solids">The list of solids, possibly empty.</param>
        /// <param name="meshes">The list of meshes, possibly empty.</param>
        /// <returns>The combined list of solids and meshes that are visible given category export settings and view visibility settings.</returns>
        public static List <GeometryObject> RemoveInvisibleSolidsAndMeshes(Document doc, ExporterIFC exporterIFC, IList <Solid> solids, IList <Mesh> meshes)
        {
            List <GeometryObject> geomObjectsIn = new List <GeometryObject>();

            if (solids != null && solids.Count > 0)
            {
                geomObjectsIn.AddRange(solids);
            }
            if (meshes != null && meshes.Count > 0)
            {
                geomObjectsIn.AddRange(meshes);
            }

            List <GeometryObject> geomObjectsOut = new List <GeometryObject>();

            View filterView = ExporterCacheManager.ExportOptionsCache.FilterViewForExport;

            foreach (GeometryObject obj in geomObjectsIn)
            {
                GraphicsStyle gStyle = doc.GetElement(obj.GraphicsStyleId) as GraphicsStyle;
                if (gStyle != null)
                {
                    Category graphicsStyleCategory = gStyle.GraphicsStyleCategory;
                    if (graphicsStyleCategory != null)
                    {
                        if (!ElementFilteringUtil.IsCategoryVisible(graphicsStyleCategory, filterView))
                        {
                            continue;
                        }

                        ElementId catId = graphicsStyleCategory.Id;

                        string ifcClassName = ExporterUtil.GetIFCClassNameFromExportTable(exporterIFC, catId);
                        if (!string.IsNullOrEmpty(ifcClassName))
                        {
                            bool foundName = String.Compare(ifcClassName, "Default", true) != 0;
                            if (foundName)
                            {
                                IFCExportInfoPair exportType = ElementFilteringUtil.GetExportTypeFromClassName(ifcClassName);
                                if (exportType.ExportInstance == IFCEntityType.UnKnown)
                                {
                                    continue;
                                }
                            }
                        }
                    }
                }
                geomObjectsOut.Add(obj);
            }

            return(geomObjectsOut);
        }
Example #24
0
        public static string strGraphicsStyleName(UIDocument uidoc)
        {
            Reference r = uidoc.Selection.PickObject(ObjectType.PointOnElement);

            Element elm = uidoc.Document.GetElement(r);

            GeometryObject geo = elm.GetGeometryObjectFromReference(r);

            GraphicsStyle gs      = uidoc.Document.GetElement(geo.GraphicsStyleId) as GraphicsStyle;
            string        strNsme = gs.GraphicsStyleCategory.Name;

            return(strNsme);
        }
Example #25
0
        /***************************************************/

        public static System.Drawing.Color Color(this Curve curve, Document document)
        {
            GraphicsStyle gs = document.GetElement(curve.GraphicsStyleId) as GraphicsStyle;

            if (gs != null && gs.GraphicsStyleCategory != null)
            {
                return(System.Drawing.Color.FromArgb(255, gs.GraphicsStyleCategory.LineColor.Red, gs.GraphicsStyleCategory.LineColor.Green, gs.GraphicsStyleCategory.LineColor.Blue));
            }
            else
            {
                return(System.Drawing.Color.Black);
            }
        }
Example #26
0
        /// <summary>
        /// Add the pair of component category name and material id pair
        /// </summary>
        /// <param name="materialId">The material id</param>
        public void AddRepresentationItemInfo(Document document, GraphicsStyle style, ElementId materialId, IFCAnyHandle repItem)
        {
            // Set with the proper category name if any
            string catName = style?.GraphicsStyleCategory?.Name;

            if (catName == null)
            {
                Material material = document.GetElement(materialId) as Material;
                catName = (material != null) ? NamingUtil.GetMaterialName(material) : "<Unnamed>"; // Default name to the Material name if not null or <Unnamed>
            }

            RepresentationItemInfo.Add(Tuple.Create(new MaterialConstituentInfo(catName, materialId), repItem));
            AddMaterial(materialId);
        }
Example #27
0
        /// <summary>
        /// 获取所有线型类别 方法二:通过document setting
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public static ICollection <ElementId> GetAllLineStyleIdsFromSetting(Document doc)
        {
            ICollection <ElementId> styles      = new List <ElementId>();
            Settings        documentSettings    = doc.Settings;
            Categories      ParentCategoyry     = doc.Settings.Categories;
            Category        ParentLineCategoyry = ParentCategoyry.get_Item(BuiltInCategory.OST_Lines);
            CategoryNameMap _CategoryNameMap    = ParentLineCategoyry.SubCategories;

            foreach (Category lineStyle in _CategoryNameMap)
            {
                GraphicsStyle _GraphicsStyle = lineStyle.GetGraphicsStyle(GraphicsStyleType.Projection);
                styles.Add(_GraphicsStyle.Id);
            }
            return(styles);
        }
Example #28
0
        /// <summary>
        /// 获取所有线型类别 方法二:通过document setting
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public static List <GraphicsStyle> getAllLineGraphicses(Document doc)
        {
            List <GraphicsStyle> lineStyles          = new List <GraphicsStyle>();
            Settings             documentSettings    = doc.Settings;
            Categories           ParentCategoyry     = doc.Settings.Categories;
            Category             ParentLineCategoyry = ParentCategoyry.get_Item(BuiltInCategory.OST_Lines);
            CategoryNameMap      _CategoryNameMap    = ParentLineCategoyry.SubCategories;

            foreach (Category lineStyle in _CategoryNameMap)
            {
                GraphicsStyle _GraphicsStyle = lineStyle.GetGraphicsStyle(GraphicsStyleType.Projection);
                lineStyles.Add(_GraphicsStyle);
            }
            return(lineStyles);
        }
Example #29
0
        public WonGame(GraphicsStyle style)
        {
            InitializeComponent();

            graphicsStyle     = style;
            button1.FlatStyle = FlatStyle.Flat;
            button1.FlatAppearance.BorderSize = 2;

            this.Text = "Congratulations";
            this.CenterToParent();
            this.MaximizeBox = false;
            this.MinimizeBox = false;

            SetGraphics();
        }
Example #30
0
 public Entity(double cTime, Particle pos, Drawable draw, PhysicsShape physS, EntityClass pc, BulletEmitter e = null, GraphicsStyle g = null)
 {
     this.pc      = pc;
     ps           = physS ?? new Point(pos.Dimension);
     CreationTime = cTime;
     creation     = new GameEvent(cTime, this.Create, this.RewindCreate, this.UndoCreate);
     this.pos     = pos;
     d            = draw;
     this.e       = e;
     gs           = g;
     if (pos != null)
     {
         this.Time = CreationTime;
     }
 }
Example #31
0
        private void Stream( ArrayList data, GraphicsStyle graphStyle )
        {
            data.Add( new Snoop.Data.ClassSeparator( typeof( GraphicsStyle ) ) );

              data.Add( new Snoop.Data.Object( "Graphics style category", graphStyle.GraphicsStyleCategory ) );
              data.Add( new Snoop.Data.String( "Graphics style type", graphStyle.GraphicsStyleType.ToString() ) );
        }