- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I have been working on some iLogic code where I am trying to save a bmp of the model. I have it to run on close of the document but I keep running into a couple issues. First randomly this will rotate the drawing to an ISO image when the model has already been closed. Second I get an error if I close the model while having the drawing open. It will not run the command and tries to run when closing the drawing and gives me an error. How can I specify to run only if its an .ipt or .iam not a .dwg or .idw. I have this set to execute on close of document because of running into issues with having it not save the files with the part number after save. We seemed to have some lag and it required the user to hit save twice in order to save the image.
Any help or advice would be appreciated.
Here is my code I currently have.
oFileName = ThisDoc.FileName(False)
Dim m_Camera As Inventor.Camera
Dim m_Doc As Inventor.Document
Dim m_TO As Inventor.TransientObjects
m_TO = ThisApplication.TransientObjects
m_Doc = ThisDoc.Document
m_Camera = ThisApplication.ActiveView.Camera
'm_Camera.Perspective = True
m_Camera.ViewOrientationType = Inventor.ViewOrientationTypeEnum.kIsoTopLeftViewOrientation
m_Camera.Fit
m_Camera.ApplyWithoutTransition
Dim m_CV as Inventor.View
m_CV = ThisApplication.ActiveView
Dim m_PrevMode As Integer
Dim m_Disp3D As Boolean
m_PrevMode = m_CV.DisplayMode
m_Disp3D = ThisApplication.DisplayOptions.Show3DIndicator
m_CV.DisplayMode = Inventor.DisplayModeEnum.kSHADEDWITHEDGESRendering
ThisApplication.DisplayOptions.Show3DIndicator = False
'MessageBox.Show(m_CV.DisplayMode)
m_CV.Update
m_Camera.SaveAsBitmap("T:\inventor workspace\inventor labels\"& oFileName &".bmp", 800, 600, m_TO.CreateColor(255,255,255))
m_CV.DisplayMode = m_PrevMode
ThisApplication.DisplayOptions.Show3DIndicator = m_Disp3D
m_CV.Update
Solved! Go to Solution.