Results 1 to 5 of 5

Thread: Simple Regen?

  1. #1
    Active Member
    Join Date
    2007-02
    Posts
    72
    Login to Give a bone
    0

    Default Simple Regen?

    I need to do a simple regen command at the end of my program, even though I have it set the program does not enact the regen. Any thoughts? It is probably something simple.

    using System;
    using Autodesk.AutoCAD.Runtime;
    using Autodesk.AutoCAD.ApplicationServices;
    using Autodesk.AutoCAD.DatabaseServices;
    using Autodesk.AutoCAD.Colors;
    using Autodesk.AutoCAD.Interop;




    [assembly: CommandClass(typeof(RemodelDWG.Commands))]

    namespace RemodelDWG
    {
    /// <summary>
    /// Remodel DWG: Program that will clean up any translation file from ARRIS for Remodel use.
    /// </summary>
    public class Commands
    {
    public Commands()
    {
    //
    // TODO: Add constructor logic here
    //
    }

    // Define Command "Remodel"
    [CommandMethod("Remodel")]
    static public void RemodelDWG() // This method can have any name
    {
    //Set current application session
    AcadApplication app;
    app = (Autodesk.AutoCAD.Interop.AcadApplication)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication;


    // Get current DWG Database
    Document acDoc = Application.DocumentManager.MdiActiveDocument;
    Database acDB = acDoc.Database;

    //Start Transaction to play with DWG.

    using (Transaction acTran = acDB.TransactionManager.StartTransaction())
    {
    //Open current drawing layer table listing and read.
    LayerTable acLayerTbl;
    acLayerTbl = acTran.GetObject(acDB.LayerTableId, OpenMode.ForRead)as LayerTable;


    // Create an ObjectIdCollection to hold the object ids for each table record
    ObjectIdCollection acObjCol = new ObjectIdCollection();

    // Step through each layer and add iterator to the ObjectIdCollection
    foreach (ObjectId acObjId in acLayerTbl)
    {
    acObjCol.Add(acObjId);
    }

    foreach (ObjectId acObjId in acObjCol)
    {

    //Get all layers in the database
    LayerTableRecord acLayerTblRec;
    acLayerTblRec = acTran.GetObject(acObjId, OpenMode.ForWrite) as LayerTableRecord;

    //unlock all layers one by one
    acLayerTblRec.IsLocked = false;

    }

    //Section to set remodel hatch layer color
    string sLayerName = "011remeqxh";
    if (acLayerTbl.Has(sLayerName) == true)
    {
    LayerTableRecord acLayerTblRec;
    acLayerTblRec = acTran.GetObject(acLayerTbl[sLayerName], OpenMode.ForWrite) as LayerTableRecord;
    acLayerTblRec.Color = Color.FromColorIndex(ColorMethod.ByLayer, 254);
    }

    app.ZoomExtents();

    acDoc.Editor.Regen();


    acTran.Commit(); // run all commands and save current state.
    }

    }

    }
    }

  2. #2
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Simple Regen?

    Quote Originally Posted by GreenMan415 View Post
    I need to do a simple regen command at the end of my program, even though I have it set the program does not enact the regen. Any thoughts? It is probably something simple.
    This code is working good on my end
    The 'regenmode' varialble is set to 1

    ~'J'~

  3. #3
    Active Member
    Join Date
    2007-02
    Posts
    72
    Login to Give a bone
    0

    Default Re: Simple Regen?

    Fixo,

    I checked the regenmode and it is set to 1. However it does not regen for me. I have to still manually do a regen. Thoughts?

  4. #4
    Active Member
    Join Date
    2007-02
    Posts
    72
    Login to Give a bone
    0

    Default Re: Simple Regen?

    Disregard, I found a fix. I threw a app update after the regen and it works fine.

  5. #5
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Simple Regen?

    Quote Originally Posted by GreenMan415 View Post
    Disregard, I found a fix. I threw a app update after the regen and it works fine.
    Glad if so
    Nice code btw I like it
    Keep programming
    All successes

    ~'J'~

Similar Threads

  1. Why are simple stairs not simple?
    By tknapp in forum Revit Architecture - General
    Replies: 1
    Last Post: 2010-10-19, 03:13 AM
  2. simple lables on simple entities
    By Maverick91 in forum AutoCAD Civil 3D - General
    Replies: 13
    Last Post: 2010-09-22, 09:38 PM
  3. VBA Regen
    By BeetleJuice in forum VBA/COM Interop
    Replies: 3
    Last Post: 2010-01-04, 07:33 PM
  4. Simple Countertop DB not so simple
    By bshank.140587 in forum Dynamic Blocks - Technical
    Replies: 3
    Last Post: 2008-04-09, 05:36 PM
  5. Drawing regen
    By Chuckyd67 in forum ACA General
    Replies: 8
    Last Post: 2004-07-15, 07:17 PM

Posting Permissions

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