.NET

Reply
Distinguished Contributor
109 Posts
7 Kudos
Registered: ‎04-05-2012
Post 1 of 2
Accepted Solution

Background image & WHIP

177 Views, 1 Replies
09-04-2013 12:17 AM

I've found a way to put an image as the background:

 

[CommandMethod("BG")]
public void Bg()
{
    Document doc = Application.DocumentManager.MdiActiveDocument;
    Database db = doc.Database;
    using (Transaction tr = db.TransactionManager.StartTransaction())
    {
        var imgBg = new ImageBackground
        {
            ImageFileName = @"...",
            FitToScreen = true
        };
        var bgDict = (DBDictionary)tr.GetObject(Background.GetBackgroundDictionaryId(db, true), OpenMode.ForWrite);
        bgDict.SetAt(Path.GetFileNameWithoutExtension(imgBg.ImageFileName), imgBg);
        tr.AddNewlyCreatedDBObject(imgBg, true);
        var vt = (ViewportTable)tr.GetObject(db.ViewportTableId, OpenMode.ForRead);
        var vtr = (ViewportTableRecord)tr.GetObject(vt[SymbolUtilityServices.ViewportActiveName], 
            OpenMode.ForWrite);
        vtr.Background = imgBg.Id;
        tr.Commit();
    }
}

 It works with AGS (3D visual style), but not with WHIP (2D Wireframe visual style). The image is not displayed.

 

Someone know how to make this work with WHIP?

It's not currently possible to display a background image in 2D whip mode. Sorry for the bad news.

ADN Support Specialist
352 Posts
27 Kudos
Registered: ‎07-24-2007
Post 2 of 2

Re: Background image & WHIP

09-09-2013 11:24 AM in reply to: FRFR1426

It's not currently possible to display a background image in 2D whip mode. Sorry for the bad news.





Fenton Webb

Developer Technical Services

Autodesk Developer Network


Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!