Hiding workplanes in generated jpg images

Hiding workplanes in generated jpg images

MikeGillam5072
Enthusiast Enthusiast
744 Views
5 Replies
Message 1 of 6

Hiding workplanes in generated jpg images

MikeGillam5072
Enthusiast
Enthusiast

I have an application that generates and stores jpg images of Inventor models.

 

I would like to hide a workplane in the generated image.  I made the workplane invisible (unchecked visibility) in both the Master and Default views, but the workplane is still visible in the generated image.

 

Here's the snippet of VB code that generates the jpg:

 

      Dim oDoc As Inventor.Document = OpenDoc(model)
       Dim oView As Inventor.View = Nothing
       oView = oDoc.Views.Item(1)
       Dim oCamera As Inventor.Camera
        oCamera = oView.Camera
        oCamera.ViewOrientationType = Inventor.ViewOrientationTypeEnum.kIsoTopRightViewOrientation
        oCamera.SetExtents(64, 64)
        oCamera.Fit()
        oCamera.Apply()
        oView.SaveAsBitmap(target, 64, 64)

 

Any ideas?

Thanks

Mike G

 

0 Likes
Accepted solutions (1)
745 Views
5 Replies
Replies (5)
Message 2 of 6

YuhanZhang
Autodesk
Autodesk

Can you try to export the view thru UI(Export->Image) to an image to see if the work plane also is there after you hide it? Is it possible to attach the model document so we can see to this issue?



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 3 of 6

MikeGillam5072
Enthusiast
Enthusiast

When I export it using the Inventor UI, it works fine (i.e. the workplane is hidden).

 

It appears to be related to the API.

 

I added a workplane to a simple model (cabinet.iam) and attached it. 

0 Likes
Message 4 of 6

sanjay.ramaswamy
Alumni
Alumni

Any design view changes (such as visibility) made to the master design view are never saved. And the Documents.Open API call opens the document in Master by default. So you should make changes to the default (or some other design view) and then open the document in that particular design view. Use Documents.OpenWithOptions method to specify a design view to open the document in.

0 Likes
Message 5 of 6

ekinsb
Alumni
Alumni

Are you sure it's a work plane that's being displayed?  When I test your code I don't see a work plane but I do see the 3D triad that's usually displayed in the lower-left of the screen.  Because the image you're creating is so small it ends up being closer to the center of the image and fills a large portion of it.  You can turn off the display of the 3D indicator.  Here's a VBA version of your program that I used for testing.

 

Public Sub SaveView()
    Dim oDoc As Inventor.Document
    Set oDoc = ThisApplication.ActiveDocument
    Dim oView As Inventor.view
    Set oView = ThisApplication.ActiveView
    Dim oCamera As Inventor.Camera
    Set oCamera = oView.Camera
    oCamera.ViewOrientationType = Inventor.ViewOrientationTypeEnum.kIsoTopRightViewOrientation
    Call oCamera.SetExtents(64, 64)
    oCamera.Fit
    oCamera.Apply
    ThisApplication.DisplayOptions.Show3DIndicator = False
    Call oView.SaveAsBitmap("C:\Temp\test.bmp", 64, 64)
    ThisApplication.DisplayOptions.Show3DIndicator = True
End Sub


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 6 of 6

MikeGillam5072
Enthusiast
Enthusiast
Accepted solution

That fixed it, and thanks for the tip on hiding the 3d indicator.

 

thanks

Mike G

0 Likes