Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
1422 Views, 4 Replies

Export picture (PNG) - ilogic - with variable Name

HI all,

 

 

    i use this Code, for Export Model to PNG Picture:

 

-----------------------------------------------------------------------------------

Option Explicit On

Dim m_Doc As Inventor.Document
m_Doc = ThisDoc.Document

If m_Doc.DocumentType <> kAssemblyDocumentObject _
   And m_Doc.DocumentType <> kPartDocumentObject Then
   MessageBox.Show("File is not a model.", "iLogic")
   Return 'exit rule
End If

Dim m_Camera As Inventor.Camera
m_Camera = ThisServer.TransientObjects.CreateCamera()
If m_Doc.DocumentType = kPartDocumentObject Then
  m_Camera.SceneObject = DirectCast(m_Doc, PartDocument).ComponentDefinition
Else
  m_Camera.SceneObject = DirectCast(m_Doc, AssemblyDocument).ComponentDefinition
End If
'm_Camera.Perspective = True

Dim m_TO As Inventor.TransientObjects
m_TO = ThisApplication.TransientObjects

Dim oFileName As String = ThisDoc.FileName(False)

m_Camera.ViewOrientationType = Inventor.ViewOrientationTypeEnum.kIsoTopLeftViewOrientation
m_Camera.Fit
m_Camera.ApplyWithoutTransition
 
Dim m_PrevMode As DisplayModeEnum
Dim m_Disp3D As Boolean

m_Disp3D = ThisApplication.DisplayOptions.Show3DIndicator
m_PrevMode = ThisApplication.DisplayOptions.NewWindowDisplayMode
 
ThisApplication.DisplayOptions.NewWindowDisplayMode = DisplayModeEnum.kSHADEDWITHEDGESRendering
ThisApplication.DisplayOptions.Show3DIndicator = False

Try
m_Camera.SaveAsBitmap("C:\Export\" & oFileName & ".png", 2970, 2100, m_TO.CreateColor(255,255,255))

Finally
ThisApplication.DisplayOptions.NewWindowDisplayMode = m_PrevMode
ThisApplication.DisplayOptions.Show3DIndicator = m_Disp3D
End Try

----------------------------------------------------------------------------------

 

But i have Problem with export more Picture from one Model -> is overwriten. I need edit code and add with variable Name (Name_001 - Name_999).

 

Please can me help sameone?

 

TY.