Revit 2020 ImageInstance

Revit 2020 ImageInstance

miketurpin_innovatingfutures
Enthusiast Enthusiast
669 Views
1 Reply
Message 1 of 2

Revit 2020 ImageInstance

miketurpin_innovatingfutures
Enthusiast
Enthusiast

Hi

 

I am having a problem with the new ImageInstance in Revit 2020.

For most users my code (shown below) works fine and the image is inserted at the right size in the right location however one of my users experiences an error even when loading exactly the same image as everyone else.

Any advise on how to fix this?...

 

"PicturePath" is a string, full file path of the .JPG image

TheSheet is a ViewSheet

 

	try
    {
        ImageTypeOptions imagetypeoptions = new ImageTypeOptions("PicturePath");
        ImageType imagetype = ImageType.Create(doc, imagetypeoptions);
        ImageInstance ii = ImageInstance.Create(doc, TheSheet, imagetype.Id, new ImagePlacementOptions());
        ii.Height = 0.3;
        ii.SetLocation(new XYZ(0.10, 0.008, 0), BoxPlacement.BottomRight);
    }
    catch (Exception e)
    {
        TaskDialog.Show("Image Error", e.Message);
    }

 

 

 

0 Likes
670 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk

Run your code in the debugger so you can see the exact values of each and every argument in every single function call. There is obviously something going on that you are not aware of and you cannot tell us, so you need to take a closer look to find out what.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes