Author Topic: select all objects, which use some style  (Read 3033 times)

0 Members and 1 Guest are viewing this topic.

Andrey Bushman

  • Swamp Rat
  • Posts: 864
select all objects, which use some style
« on: July 30, 2010, 08:07:11 AM »
Hi all.

If I want to delete style, then I must before set other styles for all objects, which use deleted style.

Whether there is a simple way of a choice of all objects which use a certain instance of:
1. text style
2. table style
3. dimension style
4. multileader style
?

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: select all objects, which use some style
« Reply #1 on: July 30, 2010, 10:19:30 AM »
I get all primitives (via array or System.Windows.Controls.TreeViewItem):
Code: [Select]
//Created by Andrey Bushman
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.ComponentModel;
//AutoCAD
using acad = Autodesk.AutoCAD.ApplicationServices.Application;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Interop.Common;
using System.Windows.Controls;

namespace Bushman.Autodesk.AutoCAD.Styles
{
    /// <summary>
    /// Searcher of primitives in drawing database
    /// </summary>
    public sealed class ObjectSearcher
    {
        Document dwg;
        Editor ed;
        Database db;
        Dictionary<string, ObjectId> xxx;
        List<object> primitives;

        /// <summary>
        /// Drawing for search
        /// </summary>
        public Document Drawing
        {
            get { return dwg; }
            set { dwg = value;
            ed = dwg.Editor;
            db = dwg.Database;
            }
        }

        /// <summary>
        /// Default search for current drawing
        /// </summary>
        public ObjectSearcher()
        {
            Drawing = acad.DocumentManager.MdiActiveDocument;
        }

        /// <summary>
        /// Get all primitives via array of objects
        /// </summary>
        /// <returns>Array of objects</returns>
        public ObjectId[] GetAllPrimitives()
        {
            List<ObjectId> primitives = new List<ObjectId>();

            using (Transaction t = dwg.TransactionManager.StartTransaction())
            {
                for (long i = db.BlockTableId.Handle.Value; i < db.Handseed.Value; i++)
                {
                    ObjectId id = ObjectId.Null;
                    try
                    {
                        id = db.GetObjectId(false, new Handle(i), 0);
                    }
                    catch (System.Exception)
                    { continue; }
                    if (!id.IsErased)
                    {
                        DBObject x = t.GetObject(id, OpenMode.ForRead);
                        primitives.Add(id);
                    }
                }
            }
            return primitives.ToArray();
        }

        /// <summary>
        /// Get all primitives via array of System.Windows.Controls.TreeViewItem
        /// </summary>
        /// <returns>return System.Windows.Controls.TreeViewItems array</returns>
        private TreeViewItem[] GetTreeViewItems()
        {
            List<TreeViewItem> primitives = new List<TreeViewItem>();

            using (Transaction t = dwg.TransactionManager.StartTransaction())
            {
                for (long i = db.BlockTableId.Handle.Value; i < db.Handseed.Value; i++)
                {
                    ObjectId id = ObjectId.Null;
                    try
                    {
                        id = db.GetObjectId(false, new Handle(i), 0);
                    }
                    catch (System.Exception)
                    { continue; }
                    if (!id.IsErased)
                    {
                        DBObject x = t.GetObject(id, OpenMode.ForRead);
                        primitives.Add(new TreeViewItem(){ Tag = x, Header = x.GetType().ToString()});
                    }
                }
            }
            return primitives.ToArray();
        }

        /// <summary>
        /// Get all primitives via hierarchy in System.Windows.Controls.TreeViewItem control (WPF).
        /// </summary>
        /// <returns>return System.Windows.Controls.TreeViewItems array</returns>
        public TreeViewItem[] GetTreePrimitives()
        {
            TreeViewItem[] tvis = GetTreeViewItems();
            List<TreeViewItem> result = new List<TreeViewItem>();
            using (Transaction t = dwg.TransactionManager.StartTransaction())
            {
                //Create tree
                foreach (TreeViewItem item in tvis)
                {
                    FindParentNode(item, tvis);
                    if (item.Parent == null) result.Add(item);
                }
            }
            return result.ToArray();
        }

        /// <summary>
        /// Find parent node for TreeViewItem
        /// </summary>
        /// <param name="item">item, for which do search</param>
        /// <param name="tvis">common nodes collection</param>
        void FindParentNode(TreeViewItem item, TreeViewItem[] tvis)
        {
            TreeViewItem tvi = tvis.Where(n => ((DBObject)n.Tag).ObjectId == ((DBObject)item.Tag).OwnerId).DefaultIfEmpty().First();
            if (tvi != null) tvi.Items.Add(item);
        }
    }
}
May be I not all primitives get?

After it I can do filter.
« Last Edit: August 03, 2010, 05:15:42 AM by Andrey »

Bryco

  • Water Moccasin
  • Posts: 1883
Re: select all objects, which use some style
« Reply #2 on: July 30, 2010, 04:21:18 PM »
I have a merge textstyle form that runs the code below, some of it may be helpful.
I found it was easier to merge a textstyle than delete it.

Code: [Select]
    class MergeTextstyles
    {
        [CommandMethod("MergeTextstyle")]

        public void Merge()
        {   
            Database db=HostApplicationServices.WorkingDatabase;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                TextStyleTable tsr = tr.GetObject(db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable;
                if (tsr == null)
                {
                    MessageBox.Show("There are no textstyles to merge, exiting");
                    return;
                }
            }
            Form MergeTextstyleform = new MergeTextstyleform.form();
            MergeTextstyleform.ShowDialog();
            if (MergeTextstyleform.ActiveControl == null) return;
            string newTstyle = "", oldTstyle = "";
            foreach (Control ct in MergeTextstyleform.Controls)
            {
                if (ct.Name == "textBox1")
                {
                    newTstyle = ct.Text;
                    break;
                }
            }
            foreach (Control ct in MergeTextstyleform.Controls)
            {
                if (ct.Name == "textBox2")
                {
                    oldTstyle = ct.Text;
                    break;
                }
            }
            MergeTextstyleform.Dispose();
            Mergetstyles(newTstyle, oldTstyle);

        }






        public void Mergetstyles(string newTstyle,string oldTstyle)
        {
            Database db = HostApplicationServices.WorkingDatabase;
            Document doc = acadApp.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;
            TextStyleTable tstyles;
           
            if (newTstyle =="") return;
            if (oldTstyle == "") return;
            if (oldTstyle == "Standard")
            {
                MessageBox.Show("The Standard textstyle cannot be deleted.");
                return;
            }

            TypedValue[] tv = { new TypedValue(0, "Text,Mtext,Acad_Table,Dimension") };
            SelectionFilter sf = new SelectionFilter(tv);
            PromptSelectionResult psr = ed.SelectAll(sf);
            if (psr.Status != PromptStatus.OK)
            {
                MessageBox.Show("There is no text or Mtext in this drawing, exiting now:");
                return;
            }
            SelectionSet ss = psr.Value;
            Entity ent;
            DBText text;
            MText mtext;
            Dimension dim;

            ObjectId oldId = ObjectId.Null,newId=ObjectId.Null;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {   
                tstyles = tr.GetObject
                    (db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable;
                oldId = Tony.DBUtils.GetSymbolTableRecordId(db.TextStyleTableId, oldTstyle);
                newId = Tony.DBUtils.GetSymbolTableRecordId(db.TextStyleTableId, newTstyle);

                //Dimstyles
                DimStyleTable dims = tr.GetObject
                    (db.DimStyleTableId, OpenMode.ForRead) as DimStyleTable;
                DimStyleTableRecord activeDim = null;
                DimStyleTableRecord tempActiveDim = tr.GetObject
                    (dims["Standard"], OpenMode.ForRead) as DimStyleTableRecord;

                foreach (ObjectId dimId in dims)
                {
                    using (Transaction tr2 = db.TransactionManager.StartTransaction())
                    {
                        DimStyleTableRecord dtr = tr2.GetObject(
                            dimId, OpenMode.ForRead) as DimStyleTableRecord;
                        if (dtr.Dimtxsty == oldId)
                        {
                            dtr.UpgradeOpen();
                            dtr.Dimtxsty = newId;
                            dtr.DowngradeOpen();
                            //Changing the active dimstyle results in an override
                            if (dimId == db.Dimstyle)
                            {
                                activeDim = dtr;
                                db.SetDimstyleData(tempActiveDim);
                            }
                        }
                        tr2.Commit();
                    }
                }
                if (activeDim != null)
                    db.SetDimstyleData(activeDim);


                //blocks
                BlockTable blocks = tr.GetObject
                    (db.BlockTableId, OpenMode.ForRead) as BlockTable;
                BlockTableRecord btr;
                foreach (ObjectId blockId in blocks)
                {
                    btr = tr.GetObject(blockId, OpenMode.ForRead) as BlockTableRecord;
                    if (btr.IsFromExternalReference) continue;
                    if (btr.IsLayout) continue;
                    if (btr.Name.Contains("*D")) continue;
                    foreach (ObjectId entId in btr)
                    {
                        ent = tr.GetObject(entId, OpenMode.ForRead) as Entity;
                        if (ent is DBText)
                        {
                            text = (DBText)ent;
                            if (text.TextStyleId == oldId)
                            {
                                text.UpgradeOpen();
                                text.TextStyleId = newId;
                            }
                            //We need to look at all blockrefs in case
                            //the attdef textstyle was changed after the insertion
                            if (ent is AttributeDefinition)
                            {
                                AttributeDefinition att = (AttributeDefinition)ent;
                                ObjectIdCollection ids = btr.GetBlockReferenceIds(true, true);
                                BlockReference br;
                                foreach (ObjectId blockrefId in ids)
                                {
                                    br = tr.GetObject
                                        (blockrefId, OpenMode.ForWrite) as BlockReference;
                                    foreach (ObjectId id in br.AttributeCollection)
                                    {
                                        AttributeReference attref = tr.GetObject
                                            (id, OpenMode.ForWrite) as AttributeReference;
                                        if (attref.TextStyleId == oldId)
                                            attref.TextStyleId = newId;
                                    }
                                }
                            }
                        }
                        if (ent is MText)
                        {
                            mtext = (MText)ent;
                            if (mtext.TextStyleId == oldId)
                            {
                                mtext.UpgradeOpen();
                                mtext.TextStyleId = newId;
                            }
                        }
                    }
                }
                tr.Commit();
            }
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                foreach (SelectedObject so in ss)
                {
                    ent = tr.GetObject(so.ObjectId, OpenMode.ForWrite) as Entity;
                    if (ent is Table)
                    {
                        Table table = (Table)ent;
                        for (int cols = 0; cols < table.Columns.Count; cols++)
                        {
                            for (int rows = 0; rows < table.Rows.Count; rows++)
                            {
                                if (table.Cells[rows, cols].TextStyleId == oldId)
                                    table.Cells[rows, cols].TextStyleId = newId;
                            }
                        }
                        continue;
                    }

                    if (ent is DBText)
                    {
                        text = (DBText)ent;
                        if (text.TextStyleId == oldId)
                            text.TextStyleId = newId;
                        continue;
                    }
                    if (ent is Dimension)
                    {
                        dim = (Dimension)ent;
                        if (dim.DimensionStyle == oldId)
                            dim.DimensionStyle = newId;
                        continue;
                    }

                    mtext = (MText)ent;
                    if (mtext.TextStyleId == oldId)
                        mtext.TextStyleId = newId;
                }//Next

                tr.Commit();
            }

            GetTableStyles(oldId, newId);

            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                TextStyleTableRecord oldTs = tr.GetObject
                    (oldId, OpenMode.ForWrite) as TextStyleTableRecord;
                db.Textstyle= newId;
                oldTs.Erase();
                ObjectIdCollection ids = new ObjectIdCollection();
                ids.Add(oldId);
                db.Purge(ids);
                tr.Commit();
            }//End using
           
        } //End Mergetstyles






        public static void GetTableStyles(ObjectId oldId, ObjectId newId)
        {
            Database db = HostApplicationServices.WorkingDatabase;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                DBDictionary nod = tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead) as DBDictionary;
                ObjectId id = nod.GetAt("ACAD_TABLESTYLE");
                DBDictionary dic = tr.GetObject(id, OpenMode.ForRead) as DBDictionary;
                TableStyle table;
                foreach (DictionaryEntry eDict in dic)
                {
                    table = tr.GetObject((ObjectId)eDict.Value, OpenMode.ForWrite) as TableStyle;
                    if (table == null) continue;
                    foreach (RowType rt in Enum.GetValues(typeof(RowType)))
                    {
                        ObjectId idv = table.TextStyle(rt);
                        if (table.TextStyle(rt) == oldId)
                            table.SetTextStyle(newId, (int)rt);
                    }
                }
                tr.Commit();
            }
        }//End GetTableStyles










        public static void MultiLine()
        {
            Database db = HostApplicationServices.WorkingDatabase;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                DBDictionary nod = tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead) as DBDictionary;
                ObjectId id = nod.GetAt("ACAD_MLINESTYLE");
                DBDictionary dic = tr.GetObject(id, OpenMode.ForRead) as DBDictionary;
                MlineStyle mlinestyle;
                foreach (DictionaryEntry eDict in dic)
                {
                    mlinestyle = tr.GetObject((ObjectId)eDict.Value, OpenMode.ForWrite) as MlineStyle;
                   // mlinestyle.Set(mlinestyle, false);
                    MlineStyleElementCollection mc = mlinestyle.Elements;
                    foreach (MlineStyleElement me in mc)
                    {
                        Util.Debug.Print(me.Offset.ToString());
                    }
                    //mlinestyle.Erase();
                   // mlinestyle.Elements = mc;

                } tr.Commit();
            }

        } //End MultiLine



    } //end Class MergeTextstle

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: select all objects, which use some style
« Reply #3 on: August 03, 2010, 05:37:54 AM »
I have a merge textstyle form that runs the code below, some of it may be helpful.
I found it was easier to merge a textstyle than delete it.

Code: [Select]
   class MergeTextstyles
    {
        [CommandMethod("MergeTextstyle")]

        public void Merge()
        {    
            Database db=HostApplicationServices.WorkingDatabase;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                TextStyleTable tsr = tr.GetObject(db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable;
                if (tsr == null)
                {
                    MessageBox.Show("There are no textstyles to merge, exiting");
                    return;
                }
            }
            Form MergeTextstyleform = new MergeTextstyleform.form();
            MergeTextstyleform.ShowDialog();
            if (MergeTextstyleform.ActiveControl == null) return;
            string newTstyle = "", oldTstyle = "";
            foreach (Control ct in MergeTextstyleform.Controls)
            {
                if (ct.Name == "textBox1")
                {
                    newTstyle = ct.Text;
                    break;
                }
            }
            foreach (Control ct in MergeTextstyleform.Controls)
            {
                if (ct.Name == "textBox2")
                {
                    oldTstyle = ct.Text;
                    break;
                }
            }
            MergeTextstyleform.Dispose();
            Mergetstyles(newTstyle, oldTstyle);

        }






        public void Mergetstyles(string newTstyle,string oldTstyle)
        {
            Database db = HostApplicationServices.WorkingDatabase;
            Document doc = acadApp.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;
            TextStyleTable tstyles;
          
            if (newTstyle =="") return;
            if (oldTstyle == "") return;
            if (oldTstyle == "Standard")
            {
                MessageBox.Show("The Standard textstyle cannot be deleted.");
                return;
            }

            TypedValue[] tv = { new TypedValue(0, "Text,Mtext,Acad_Table,Dimension") };
            SelectionFilter sf = new SelectionFilter(tv);
            PromptSelectionResult psr = ed.SelectAll(sf);
            if (psr.Status != PromptStatus.OK)
            {
                MessageBox.Show("There is no text or Mtext in this drawing, exiting now:");
                return;
            }
            SelectionSet ss = psr.Value;
            Entity ent;
            DBText text;
            MText mtext;
            Dimension dim;

            ObjectId oldId = ObjectId.Null,newId=ObjectId.Null;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {  
                tstyles = tr.GetObject
                    (db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable;
                oldId = Tony.DBUtils.GetSymbolTableRecordId(db.TextStyleTableId, oldTstyle);
                newId = Tony.DBUtils.GetSymbolTableRecordId(db.TextStyleTableId, newTstyle);

                //Dimstyles
                DimStyleTable dims = tr.GetObject
                    (db.DimStyleTableId, OpenMode.ForRead) as DimStyleTable;
                DimStyleTableRecord activeDim = null;
                DimStyleTableRecord tempActiveDim = tr.GetObject
                    (dims["Standard"], OpenMode.ForRead) as DimStyleTableRecord;

                foreach (ObjectId dimId in dims)
                {
                    using (Transaction tr2 = db.TransactionManager.StartTransaction())
                    {
                        DimStyleTableRecord dtr = tr2.GetObject(
                            dimId, OpenMode.ForRead) as DimStyleTableRecord;
                        if (dtr.Dimtxsty == oldId)
                        {
                            dtr.UpgradeOpen();
                            dtr.Dimtxsty = newId;
                            dtr.DowngradeOpen();
                            //Changing the active dimstyle results in an override
                            if (dimId == db.Dimstyle)
                            {
                                activeDim = dtr;
                                db.SetDimstyleData(tempActiveDim);
                            }
                        }
                        tr2.Commit();
                    }
                }
                if (activeDim != null)
                    db.SetDimstyleData(activeDim);


                //blocks
                BlockTable blocks = tr.GetObject
                    (db.BlockTableId, OpenMode.ForRead) as BlockTable;
                BlockTableRecord btr;
                foreach (ObjectId blockId in blocks)
                {
                    btr = tr.GetObject(blockId, OpenMode.ForRead) as BlockTableRecord;
                    if (btr.IsFromExternalReference) continue;
                    if (btr.IsLayout) continue;
                    if (btr.Name.Contains("*D")) continue;
                    foreach (ObjectId entId in btr)
                    {
                        ent = tr.GetObject(entId, OpenMode.ForRead) as Entity;
                        if (ent is DBText)
                        {
                            text = (DBText)ent;
                            if (text.TextStyleId == oldId)
                            {
                                text.UpgradeOpen();
                                text.TextStyleId = newId;
                            }
                            //We need to look at all blockrefs in case
                            //the attdef textstyle was changed after the insertion
                            if (ent is AttributeDefinition)
                            {
                                AttributeDefinition att = (AttributeDefinition)ent;
                                ObjectIdCollection ids = btr.GetBlockReferenceIds(true, true);
                                BlockReference br;
                                foreach (ObjectId blockrefId in ids)
                                {
                                    br = tr.GetObject
                                        (blockrefId, OpenMode.ForWrite) as BlockReference;
                                    foreach (ObjectId id in br.AttributeCollection)
                                    {
                                        AttributeReference attref = tr.GetObject
                                            (id, OpenMode.ForWrite) as AttributeReference;
                                        if (attref.TextStyleId == oldId)
                                            attref.TextStyleId = newId;
                                    }
                                }
                            }
                        }
                        if (ent is MText)
                        {
                            mtext = (MText)ent;
                            if (mtext.TextStyleId == oldId)
                            {
                                mtext.UpgradeOpen();
                                mtext.TextStyleId = newId;
                            }
                        }
                    }
                }
                tr.Commit();
            }
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                foreach (SelectedObject so in ss)
                {
                    ent = tr.GetObject(so.ObjectId, OpenMode.ForWrite) as Entity;
                    if (ent is Table)
                    {
                        Table table = (Table)ent;
                        for (int cols = 0; cols < table.Columns.Count; cols++)
                        {
                            for (int rows = 0; rows < table.Rows.Count; rows++)
                            {
                                if (table.Cells[rows, cols].TextStyleId == oldId)
                                    table.Cells[rows, cols].TextStyleId = newId;
                            }
                        }
                        continue;
                    }

                    if (ent is DBText)
                    {
                        text = (DBText)ent;
                        if (text.TextStyleId == oldId)
                            text.TextStyleId = newId;
                        continue;
                    }
                    if (ent is Dimension)
                    {
                        dim = (Dimension)ent;
                        if (dim.DimensionStyle == oldId)
                            dim.DimensionStyle = newId;
                        continue;
                    }

                    mtext = (MText)ent;
                    if (mtext.TextStyleId == oldId)
                        mtext.TextStyleId = newId;
                }//Next

                tr.Commit();
            }

            GetTableStyles(oldId, newId);

            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                TextStyleTableRecord oldTs = tr.GetObject
                    (oldId, OpenMode.ForWrite) as TextStyleTableRecord;
                db.Textstyle= newId;
                oldTs.Erase();
                ObjectIdCollection ids = new ObjectIdCollection();
                ids.Add(oldId);
                db.Purge(ids);
                tr.Commit();
            }//End using
            
        } //End Mergetstyles






        public static void GetTableStyles(ObjectId oldId, ObjectId newId)
        {
            Database db = HostApplicationServices.WorkingDatabase;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                DBDictionary nod = tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead) as DBDictionary;
                ObjectId id = nod.GetAt("ACAD_TABLESTYLE");
                DBDictionary dic = tr.GetObject(id, OpenMode.ForRead) as DBDictionary;
                TableStyle table;
                foreach (DictionaryEntry eDict in dic)
                {
                    table = tr.GetObject((ObjectId)eDict.Value, OpenMode.ForWrite) as TableStyle;
                    if (table == null) continue;
                    foreach (RowType rt in Enum.GetValues(typeof(RowType)))
                    {
                        ObjectId idv = table.TextStyle(rt);
                        if (table.TextStyle(rt) == oldId)
                            table.SetTextStyle(newId, (int)rt);
                    }
                }
                tr.Commit();
            }
        }//End GetTableStyles










        public static void MultiLine()
        {
            Database db = HostApplicationServices.WorkingDatabase;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                DBDictionary nod = tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead) as DBDictionary;
                ObjectId id = nod.GetAt("ACAD_MLINESTYLE");
                DBDictionary dic = tr.GetObject(id, OpenMode.ForRead) as DBDictionary;
                MlineStyle mlinestyle;
                foreach (DictionaryEntry eDict in dic)
                {
                    mlinestyle = tr.GetObject((ObjectId)eDict.Value, OpenMode.ForWrite) as MlineStyle;
                   // mlinestyle.Set(mlinestyle, false);
                    MlineStyleElementCollection mc = mlinestyle.Elements;
                    foreach (MlineStyleElement me in mc)
                    {
                        Util.Debug.Print(me.Offset.ToString());
                    }
                    //mlinestyle.Erase();
                   // mlinestyle.Elements = mc;

                } tr.Commit();
            }

        } //End MultiLine



    } //end Class MergeTextstle

Thank you for code. I have some questions:
1.
Code: [Select]
TextStyleTable tsr = tr.GetObject(db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable;
                if ([color=red]tsr == null[/color])
                {...
Why you do it check? Can db.TextStyleTableId specify on null?

2. What about if object was create via "_rtext", "_.arctext" (from Express menu)?
It's commands create objects: RText and ArcAlignedText.
Via my code I can't find information about RText and ArcAlignedText.

Bryco

  • Water Moccasin
  • Posts: 1883
Re: select all objects, which use some style
« Reply #4 on: August 03, 2010, 11:49:42 AM »
 if (tsr == null) -I would say I added this for when a shapefont is missing from the current textstyle.
We get so many weird drawings that  I can't remember exactly why I did that.
The Arctext looks interesting as the dll in express isnt able to be loaded.
It has a type that isn't listed anywhere in the object browser.

Rtext I would say you would have to open the file to change the style as it is virtually an xref

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: select all objects, which use some style
« Reply #5 on: August 03, 2010, 01:20:14 PM »
if (tsr == null) -I would say I added this for when a shapefont is missing from the current textstyle.
We get so many weird drawings that  I can't remember exactly why I did that.
If AutoCAD can't find font file, then it use font, which place in ALTFONT variable. Before create text style, you can check exists font file and use font from ALTFONT if necessary font not found.
Code: [Select]
The Arctext looks interesting as the dll in express isnt able to be loaded.
It has a type that isn't listed anywhere in the object browser.
Rtext I would say you would have to open the file to change the style as it is virtually an xref
Is such objects it will not be possible (change of TextStyle for them via .net)?