Ilogic generate jpg

Ilogic generate jpg

Anonymous
Not applicable
1,442 Views
5 Replies
Message 1 of 6

Ilogic generate jpg

Anonymous
Not applicable

Hi

I run a script, while I have a drawing on the screen, which generate pdf (drawing) and step (part). Now I also would like this script to generate a jpg of the part. I found this script that works fine.

https://forums.autodesk.com/t5/inventor-forum/ilogic-save-image-of-model/td-p/6875045

But I would like to start this script while I have my drawing on the screen so the jpg would be made of the part. What are missing in the script to make it possible?

//Goran

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

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

With this code you can create an image of the reference document of the view (in my example accessing through the item).
This ilogic is executed from the drawing file.
You must specify well the path where the image will be saved, in micaso the disk "E".
I hope it is useful for you. regards

 

oPath = "E:\"

Dim oDoc As DrawingDocument
oDoc = ThisDoc.Document
Dim oSheet As Sheet
oSheet = oDoc.ActiveSheet

Dim oView As DrawingView = oSheet.DrawingViews.Item(1)

oViewModelDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument

Dim oViewModelDocName As String = Left(oViewModelDoc.DisplayName, (InStrRev(oViewModelDoc.DisplayName, ".", - 1, vbTextCompare) - 1))

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

Dim m_TO As Inventor.TransientObjects
m_TO = ThisApplication.TransientObjects

m_Camera.ViewOrientationType = Inventor.ViewOrientationTypeEnum.kIsoTopLeftViewOrientation
m_Camera.Fit
m_Camera.ApplyWithoutTransition
 
ThisApplication.DisplayOptions.NewWindowDisplayMode = DisplayModeEnum.kShadedWithEdgesRendering
ThisApplication.DisplayOptions.Show3DIndicator = False

Dim TumbFilename As String = oPath & oViewModelDocName & ".bmp"

m_Camera.SaveAsBitmap(TumbFilename, 800, 600, m_TO.CreateColor(255,255,255))

Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 3 of 6

Anonymous
Not applicable

Hi

The script works perfectly. 

Thanks!

//Goran

 

0 Likes
Message 4 of 6

kwilson_design
Collaborator
Collaborator

Hello all,

 

I'm trying to do a simlar task with iLogic and can't seem to get it to work. We have a new webstore we are implementing and they need jpeg's of all the 3D models. I'm trying to find a way to run an iLogic rule on save that will:

  • use the all white background setting (many engineers like to use different display backgrounds but webstore needs to be consistent with all white background).
  • perform zoom extents
  • use the same isometric camera view each time
  • create jpeg on save (doing it upon check-in to Vault would be even better but not required)
  • save jpeg to a specified folder.

I've tried to search for a post similar to my needs and have found bits and pieces of the code for this sort of task but I keeping having failures. I'll admit I'm not the most savvy iLogic coder either lol. Any help guys? Much appreciated and I'd buy you virtual beer! 😄

Regards,
Kenny
If this post solved your issue please mark "Accept as Solution". It helps everyone...really!
0 Likes
Message 5 of 6

jltw7PSW2
Enthusiast
Enthusiast

Hi Kenny,

 

I am currently in a similar situation.
I know this post and comment are fairly old at this point, but i'm wondering if you ever found a soloution to this?

 

Best Regards

Jonas

0 Likes
Message 6 of 6

Mathias_CompC
Enthusiast
Enthusiast

I recently replied to another thread that in the end didn't really need the answer I gave, but perhaps it could help you out.

Here 

0 Likes