See the top rated post in this thread. Click here

Results 1 to 3 of 3

Thread: Trouble with description

  1. #1
    Login to Give a bone
    0

    Default Trouble with description

    Hello everyone!

    I have a trouble with a description for my layer. Command in general works normaly, but description doesn't assign desired string. Who it is so?


    Code:
     public static void DrawM ()
              {
                   Document acDoc = Application.DocumentManager.MdiActiveDocument;
                   Database acCurDb = acDoc.Database;
                   using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction( ))
                   {
                        LayerTable acLyrTbl;
                        acLyrTbl = acTrans.GetObject(acCurDb.LayerTableId, OpenMode.ForRead) as LayerTable;
    
                        string LayerName = "-10-Formats";
                        string VLayerName = "-10-Viewports";
    
                        if (acLyrTbl.Has(LayerName) == false)
                             using (LayerTableRecord acLyrTblRec = new LayerTableRecord( ))
                             {
                                  // Assign the layer the ACI color 3 and a name
                                  acLyrTblRec.Color = Color.FromColorIndex(ColorMethod.ByAci, 7);
                                  acLyrTblRec.Name = LayerName;
                                  acLyrTblRec.Description = "Layer owned by 101 sector, only for GOST titles";
    
                                  // Upgrade the Layer table for write
                                  acLyrTbl.UpgradeOpen( );
    
                                  // Append the new layer to the Layer table and the transaction
                                  acLyrTbl.Add(acLyrTblRec);
                                  acTrans.AddNewlyCreatedDBObject(acLyrTblRec, true);
                             }
    acTrans.Commit;
    }
    }

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,409
    Login to Give a bone
    1

    Default Re: Trouble with description

    I think you need to add the layer first, then change its properties. Move your description line to after AddNewlycreatedDBObject. Then commit the tr.
    C:> ED WORKING....


    LinkedIn

  3. #3
    Login to Give a bone
    0

    Default Re: Trouble with description

    Thank you! It works!

Similar Threads

  1. Replies: 2
    Last Post: 2012-04-24, 05:44 PM
  2. Job Description
    By Bryan Thatcher in forum CAD Management - General
    Replies: 7
    Last Post: 2009-03-07, 02:12 AM
  3. Description Key
    By avn in forum AutoCAD Civil 3D - General
    Replies: 1
    Last Post: 2008-05-13, 12:10 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •