Beispiel #1
0
 public FacadeFrontBlock(BlockReference blRef)
 {
     Position       = blRef.Position;
     BlName         = blRef.GetEffectiveName();
     IdBlRef        = blRef.Id;
     Extents        = blRef.GeometricExtentsСlean();
     RectangleRTree = new Rectangle(Extents.MinPoint.X, Extents.MinPoint.Y, Extents.MaxPoint.X, Extents.MaxPoint.Y, 0, 0);
 }
 public FacadeFrontBlock(BlockReference blRef)
 {
     Position = blRef.Position;
     BlName = blRef.GetEffectiveName();
     IdBlRef = blRef.Id;
     Extents = blRef.GeometricExtentsСlean();
     RectangleRTree = new Rectangle(Extents.MinPoint.X, Extents.MinPoint.Y, Extents.MaxPoint.X, Extents.MaxPoint.Y, 0, 0);
 }
 public BlockRefDublicateInfo([NotNull] BlockReference blRef, Matrix3d transToModel, double rotateToModel)
 {
     IdBlRef          = blRef.Id;
     Transform        = blRef.BlockTransform;
     TransformToModel = transToModel;
     Position         = blRef.Position.TransformBy(TransformToModel);
     Name             = blRef.GetEffectiveName();
     Rotation         = getRotateToModel(blRef.Rotation, rotateToModel);
 }
Beispiel #4
0
        // Private method
        private void SetProperties([NotNull] BlockReference br)
        {
#pragma warning disable 618
            Name = br.GetEffectiveName();
#pragma warning restore 618
            Attributes = new Dictionary <string, string>();
            br.AttributeCollection
            .GetObjects <AttributeReference>()
            .Iterate(att => Attributes.Add(att.Tag.ToUpper(), att.TextString));
        }
Beispiel #5
0
        public string GetName([NotNull] BlockReference blRef)
        {
            if (!dict.TryGetValue(blRef.DynamicBlockTableRecord, out var blName))
            {
                blName = blRef.GetEffectiveName();
                dict[blRef.DynamicBlockTableRecord] = blName;
            }

            return(blName);
        }
Beispiel #6
0
 // Private method
 private void SetProperties(BlockReference br)
 {
     if (br == null)
     {
         return;
     }
     _name = br.GetEffectiveName();
     _atts = new Dictionary <string, string>();
     br.AttributeCollection
     .GetObjects <AttributeReference>()
     .Iterate(att => _atts.Add(att.Tag.ToUpper(), att.TextString));
 }
        internal bool GetName_ID(Transaction acTrans, SelectionSet acSelectionSet, ref string strBlockName, ref ObjectId objectId)
        {
            if (acSelectionSet != null)
            {
                foreach (SelectedObject acSelectedObj in acSelectionSet)
                {
                    if (acSelectedObj != null)
                    {
                        Entity acEnt = acTrans.GetObject(acSelectedObj.ObjectId, OpenMode.ForRead) as Entity;
                        if (acEnt is BlockReference)
                        {
                            BlockReference acBlkRef = acTrans.GetObject(acSelectedObj.ObjectId, OpenMode.ForRead) as BlockReference;
                            objectId = acSelectedObj.ObjectId;
                            if (acBlkRef.IsDynamicBlock)
                            {
                                strBlockName = acBlkRef.GetEffectiveName(acTrans);
                            }
                            else
                            {
                                strBlockName = acBlkRef.Name;
                            }

                            if (objectId == ObjectId.Null || strBlockName == "")
                            {
                                return(false);
                            }

                            return(true);
                        }
                        return(false);
                    }
                }
            }
            else
            {
                return(false);
            }

            return(false);
        }
        internal bool GetName_ID(Transaction acTrans, SelectionSet acSelectionSet, ref List <string> lstBlockNames, ref List <ObjectId> lstObjectIds)
        {
            string   strBlockName = "";
            ObjectId objectId     = ObjectId.Null;

            if (acSelectionSet != null)
            {
                foreach (SelectedObject acSelectedObj in acSelectionSet)
                {
                    if (acSelectedObj != null)
                    {
                        Entity acEnt = acTrans.GetObject(acSelectedObj.ObjectId, OpenMode.ForRead) as Entity;
                        if (acEnt is BlockReference)
                        {
                            BlockReference acBlkRef = acTrans.GetObject(acSelectedObj.ObjectId, OpenMode.ForRead) as BlockReference;
                            objectId = acSelectedObj.ObjectId;
                            if (acBlkRef.IsDynamicBlock)
                            {
                                strBlockName = acBlkRef.GetEffectiveName(acTrans);
                            }
                            else
                            {
                                strBlockName = acBlkRef.Name;
                            }

                            lstBlockNames.Add(strBlockName);
                            lstObjectIds.Add(objectId);
                        }
                    }
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
 /// <summary>
 /// Gets the name of the effective.
 /// </summary>
 /// <param name="blockref">The blockref.</param>
 /// <returns></returns>
 public static string GetEffectiveName(this BlockReference blockref)
 {
     return(blockref.GetEffectiveName(blockref.Database.TransactionManager.TopTransaction));
 }