.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LayerTableRecord.ViewportVisibilityDefault property not changed

2 REPLIES 2
Reply
Message 1 of 3
Andrey_Bushman
887 Views, 2 Replies

LayerTableRecord.ViewportVisibilityDefault property not changed

 

 

 

            using (Transaction t = dwg.TransactionManager.StartTransaction())// dwg -> Document
            {
                LayerTable lt = (LayerTable) t.GetObject(db.LayerTableId, OpenMode.ForRead);
                foreach (ObjectId layerId in lt)
                {
                    if (layerId != db.LayerZero)// db -> Database
                    {
                        bool x = false;
                        LayerTableRecord layer = (LayerTableRecord)t.GetObject(layerId, OpenMode.ForWrite);
                        layer.Color = Color.FromColor(System.Drawing.Color.Red);
                        EntityColor color = layer.EntityColor;
                        layer.Description = "примечание";
                        layer.IsFrozen = x;
                        layer.IsHidden = x;
                        layer.IsLocked = x;
                        layer.IsOff = x;
                        layer.IsPlottable = x;
                        layer.IsReconciled = x;
                        bool xx = layer.IsUsed;
                        ObjectId lineType = layer.LinetypeObjectId;
                        layer.LineWeight = LineWeight.LineWeight158;
                        ObjectId mat = layer.MaterialId;
                        string psName = layer.PlotStyleName;
                        ObjectId psId = layer.PlotStyleNameId;
                        DBObject a = null;
                        if (psId != ObjectId.Null)
                        {
                            a = t.GetObject(psId, OpenMode.ForRead);
                        }                       
                        layer.Transparency = new Transparency((byte)50);
                        layer.ViewportVisibilityDefault = x;// x = false, but... it property not changed.. why???. it's .net api realisation mistake?
                    }                    
                }
                t.Commit();
            }

 result screen:

 

1252i455A5DB0C47D75EC

 

 

 

 

 

2 REPLIES 2
Message 2 of 3
Jeffrey_H
in reply to: Andrey_Bushman

If you want it frozen in viewports

ViewportVisibilityDefault = true;

 

1254iBC637AC1909A89F3

You can also find your answers @ TheSwamp
Message 3 of 3
Andrey_Bushman
in reply to: Jeffrey_H

Thank you!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost