Screenshot change Model edge color when using view SaveAsBitmapWithOptions

Screenshot change Model edge color when using view SaveAsBitmapWithOptions

wolfgang_nickl
Advocate Advocate
1,160 Views
7 Replies
Message 1 of 8

Screenshot change Model edge color when using view SaveAsBitmapWithOptions

wolfgang_nickl
Advocate
Advocate

Hello together,

we have changed from Inventor 2019 to 2021. We use Method SaveAsBitmapWithOption from view object to make Screenshots in Inventor VBA. With new Inventor displaying Modell Edges has changed. We use highlight against Background to better see the model edges. The model edges are bright and you can see borehole and so on. But when we use SaveAsBitmapWithOption and a transparent Background the Modell edges are changed to a dark Color.

In the Picture you can see the difference. Left side is the screensetting and Right side Shows the save as result.

As you can see it is very difficult to see the boreholse and so on.

image.png

Is there a possibility to get the bright edges in the SaveAs Bitmap?

 

Best regards

Wolfgang

0 Likes
Accepted solutions (2)
1,161 Views
7 Replies
Replies (7)
Message 2 of 8

WCrihfield
Mentor
Mentor

One idea:

Are you familiar with using Transactions?  Basically, you can create a Transaction within your code to encapsulate multiple actions so that they can all be 'undone' with one click of the 'Undo' button (or equivalent with code).  You could use this to loop through and change the color of all edges to a bright (or other high contrast) color,  then end the transaction.  Use your SaveAsBitmapWithOptions sub.  Then undo the transaction that changed to the edge colors.  All within the same rule/code.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 8

wolfgang_nickl
Advocate
Advocate

Hello WCrifield,

 

thank you for your suggestion, if no other solution is possible I will check this.

But I think it is very timeconsuming in big assemblies.

 

Best Regards

Wolfgang

 

0 Likes
Message 4 of 8

WCrihfield
Mentor
Mentor

It looks like you may be using the "Shaded With Edges" Visual Style.  Would changing to a different Visual Style, and/or changing the Lighting Style, and/or Shadows settings help the image quality in an acceptable way?  All these can be manipulated by code, too.  There is also "SaveAsBitmapWithRayTracing", but I'm not sure it would improve the image in the needed way.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 8

WCrihfield
Mentor
Mentor

I haven't tried it before, within the Document Settings > Standard tab > Display Appearance [Settings...],  there are several settings for how you want Model Edges to appear.  And in the Application Options > Display tab > Appearance area, you could set this to either "Use document settings" or "Use application settings".  And in Application Options > Colors tab there are settings for "Enable Prehighlight" and "Enable Enhanced Highlighting".  (The Prehighlight color for edges can (and usually is) set to a different color than the regular selected color.)  Then when you click on the "Customize Schemes" button (on the same tab), within the "Graphical Elements" area, click to expand the "Design" node, then click to expand the "Selection" node, you can specify a different color for those situations.

I know you can also simulate prehighlighting, highlighting, and selecting objects by code.

I'm not sure if those highlighted edges (caused by those statuses) will be maintained while the image is captured by your sub though.  You can try it and see, though.  Should be far less time consuming and require less system resources to do it this way, if it works.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 8

wolfgang_nickl
Advocate
Advocate

Hello WCrihfield,

yes we use "Shaded With Edges" and I know the settings you described in your next post.

And if it is necessary I have to program a more complex solution.

I'm looking for a simple solution that compansates the wrong behavior of Inventor 2021.

Why doesn't use Inventor the Application Setting and switches to another setting?

 

We found out that when we set the edges to a fixed color, SaveAsBitmap doesn't change

the color setting of edges. See the marked setting of a german Inventor 2021.

setting.png

But I didn't found to do this setting with the API yet.

Do you now how to set to 'One Color' (Eine Farbe) to 'Highlight against background' (Gegen Hintergrund hervorheben) with API and set back?

 

Best Regards

Wolfgang

0 Likes
Message 7 of 8

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @wolfgang_nickl 

Setting an edge color like this will automatically switch this setting to "One color". (White in this case)

ThisApplication.DisplayOptions.EdgeColor = ThisApplication.TransientObjects.CreateColor(255,255,255)

  Then to switch back to the "Use part color"-option just set it to nothing.

ThisApplication.DisplayOptions.EdgeColor = Nothing

 

EDIT: I think I missunderstood your question, sorry 😄

Or maybe this is what you're looking for? I'm confused about the Highlight against background option for one color. I can't find anything like it in the UI.

I see it now in your screenshot. I guess it just doesn't exist in 2020...

JhoelForshav_0-1599808685711.png

 

 

Message 8 of 8

wolfgang_nickl
Advocate
Advocate
Accepted solution

Hello Jhoel,

 

this is the solution for me, thank you very mutch. Before SaveAsBitmap I set the EdgeColor to the new value an after that I set it to nothing.

Dim oWNSaveOption As NameValueMap
Set oWNSaveOption = ThisApplication.TransientObjects.CreateNameValueMap
oWNSaveOption.value("TransparentBackground") = True
ThisApplication.DisplayOptions.EdgeColor = ThisApplication.TransientObjects.CreateColor(157, 158, 159)
Call ThisApplication.ActiveView.SaveAsBitmapWithOptions(strWNpath, pixelWidth, pixelHeight, oWNSaveOption)
ThisApplication.DisplayOptions.EdgeColor = Nothing

 

Best Regards

Wolfgang

0 Likes