//TABLE MUST BE ADDED TO DRAWING BEFORE THIS PROCESS CAN HAPPEND
 public static void AddBlockToTable(Table table, Database db, SortedSet <FixtureDetails> fixtureDetails)
 {
     using (Transaction tr = db.TransactionManager.StartTransaction())
     {
         Table t = (Table)tr.GetObject(table.ObjectId, OpenMode.ForWrite);
         for (int i = 2; i < t.Rows.Count; i++)
         {
             Goodies.InsertDynamicBlockToTableCell(t.Cells[i, 0], db, ConstantName.HexNote, fixtureDetails.ElementAt(i - 2));
         }
         tr.Commit();
     }
 }
Exemplo n.º 2
0
        private void GetTopAndBottomPoint(BlockReference block, Transaction tr)
        {
            model                 = new AreaBorderModel();
            model.handle          = Goodies.ConvertHandleToString(block.Handle);
            model.position        = new Point3dModel(block.Position.ToArray());
            model.matrixTransform = new Matrix3dModel(block.BlockTransform.ToArray());

            DynamicBlockReferencePropertyCollection dynBlockPropCol = block.DynamicBlockReferencePropertyCollection;

            foreach (DynamicBlockReferenceProperty dynProp in dynBlockPropCol)
            {
                if (dynProp.PropertyName.Equals(DBFixtureBeingUsedAreaName.X))
                {
                    model.X = (double)dynProp.Value;
                }
                else if (dynProp.PropertyName.Equals(DBFixtureBeingUsedAreaName.Y))
                {
                    model.Y = (double)dynProp.Value;
                }
                else if (dynProp.PropertyName.Equals("Origin"))
                {
                    model.origin = new Point3dModel(((Point3d)dynProp.Value).ToArray());
                }
            }

            foreach (ObjectId id in block.AttributeCollection)
            {
                AttributeReference aRef = (AttributeReference)tr.GetObject(id, OpenMode.ForRead);
                if (aRef.Tag == AreaBroderModelName.type)
                {
                    model.type = aRef.TextString;
                }
                else if (aRef.Tag == AreaBroderModelName.alias)
                {
                    model.alias = aRef.TextString;
                }
            }

            Point3d pointTop = new Point3d(model.origin.X, model.origin.Y, 0);
            //Use the regular X,Y coordinate, DO NOT use Game or Web coordinate
            Point3d pointBottom = new Point3d(model.origin.X + model.X, model.origin.Y - model.Y, 0);

            pointTop    = pointTop.TransformBy(block.BlockTransform);
            pointBottom = pointBottom.TransformBy(block.BlockTransform);

            model.pointBottom = new Point3dModel(pointBottom.ToArray());
            model.pointTop    = new Point3dModel(pointTop.ToArray());
        }
Exemplo n.º 3
0
 private void FilloutVariables(BlockReference bref, Transaction tr)
 {
     model                 = new InsertPointModel();
     model.handle          = Goodies.ConvertHandleToString(bref.Handle);
     model.position        = new Point3dModel(bref.Position.ToArray());
     model.matrixTransform = new Matrix3dModel(bref.BlockTransform.ToArray());
     foreach (ObjectId id in bref.AttributeCollection)
     {
         AttributeReference aRef = (AttributeReference)tr.GetObject(id, OpenMode.ForRead);
         if (aRef.Tag == InsertPointName.NAME)
         {
             model.name = aRef.TextString;
         }
         else if (aRef.Tag == InsertPointName.ALIAS)
         {
             model.alias = aRef.TextString;
         }
     }
 }
        private void GetTopAndBottomPoint(BlockReference block)
        {
            model                 = new FixtureBeingUsedAreaModel();
            model.handle          = Goodies.ConvertHandleToString(block.Handle);
            model.position        = new Point3dModel(block.Position.ToArray());
            model.matrixTransform = new Matrix3dModel(block.BlockTransform.ToArray());

            DynamicBlockReferencePropertyCollection dynBlockPropCol = block.DynamicBlockReferencePropertyCollection;

            foreach (DynamicBlockReferenceProperty dynProp in dynBlockPropCol)
            {
                if (dynProp.PropertyName.Equals(DBFixtureBeingUsedAreaName.X))
                {
                    model.X = (double)dynProp.Value;
                }
                else if (dynProp.PropertyName.Equals(DBFixtureBeingUsedAreaName.Y))
                {
                    model.Y = (double)dynProp.Value;
                }
                else if (dynProp.PropertyName.Equals("Origin"))
                {
                    model.origin = new Point3dModel(((Point3d)dynProp.Value).ToArray());
                }
            }

            Point3d pointTop = new Point3d(model.origin.X, model.origin.Y, 0);

            //Use the regular X,Y coordinate, DO NOT use Game or Web coordinate
            Point3d pointBottom = new Point3d(model.origin.X + model.X, model.origin.Y - model.Y, 0);

            pointTop    = pointTop.TransformBy(block.BlockTransform);
            pointBottom = pointBottom.TransformBy(block.BlockTransform);

            model.pointBottom = new Point3dModel(pointBottom.ToArray());
            model.pointTop    = new Point3dModel(pointTop.ToArray());
        }
        private void FillOutVariable(BlockReference bref, Transaction tr)
        {
            model.position        = new Point3dModel(bref.Position.ToArray());
            model.handle          = Goodies.ConvertHandleToString(bref.Handle);
            model.matrixTransform = new Matrix3dModel(bref.BlockTransform.ToArray());

            foreach (ObjectId id in bref.AttributeCollection)
            {
                AttributeReference aRef       = (AttributeReference)tr.GetObject(id, OpenMode.ForRead);
                string             textString = aRef.TextString;
                double             number;
                bool isNumber = double.TryParse(textString, out number);

                if (isNumber)
                {
                    if (aRef.Tag == FixtureDetailsName.index)
                    {
                        model.INDEX = number;
                    }
                    else if (aRef.Tag == FixtureDetailsName.CW_DIA)
                    {
                        model.CW_DIA = number;
                    }
                    else if (aRef.Tag == FixtureDetailsName.HW_DIA)
                    {
                        model.HW_DIA = number;
                    }
                    else if (aRef.Tag == FixtureDetailsName.WASTE_DIA)
                    {
                        model.WASTE_DIA = number;
                    }
                    else if (aRef.Tag == FixtureDetailsName.VENT_DIA)
                    {
                        model.VENT_DIA = number;
                    }
                    else if (aRef.Tag == FixtureDetailsName.STORM_DIA)
                    {
                        model.STORM_DIA = number;
                    }
                    else if (aRef.Tag == FixtureDetailsName.WSFU)
                    {
                        model.WSFU = number;
                    }
                    else if (aRef.Tag == FixtureDetailsName.CWSFU)
                    {
                        model.CWSFU = number;
                    }
                    else if (aRef.Tag == FixtureDetailsName.HWSFU)
                    {
                        model.HWSFU = number;
                    }
                    else if (aRef.Tag == FixtureDetailsName.DFU)
                    {
                        model.DFU = number;
                    }
                    else if (aRef.Tag == FixtureDetailsName.number)
                    {
                        model.NUMBER = textString;
                    }
                }
                else if (aRef.Tag == FixtureDetailsName.number)
                {
                    model.NUMBER = textString;
                }
                else if (aRef.Tag == FixtureDetailsName.tag)
                {
                    model.TAG = textString;
                }
                else if (aRef.Tag == FixtureDetailsName.FixtureName)
                {
                    model.FIXTURENAME = textString;
                }
                else if (aRef.Tag == FixtureDetailsName.DESCRIPTION)
                {
                    model.DESCRIPTION = textString;
                }
            }
        }