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

Background image & WHIP

1 REPLY 1
SOLVED
Reply
Message 1 of 2
FRFR1426
479 Views, 1 Reply

Background image & WHIP

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?

Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr
1 REPLY 1
Message 2 of 2
fenton.webb
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
AutoCAD Engineering
Autodesk

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