Script Tip Friday- Displaying txt, PDF or browser contents in your worksheet

Script Tip Friday- Displaying txt, PDF or browser contents in your worksheet

No alt text provided for this image

Our Script Tip this week comes from our Senior Application Engineer here at Ansys, Vishnu Venkataraman. Have you ever wondered the best way to display text, PDF or browser contents in your worksheet? Well thank goodness we have Vishnu here to help!

"Some examples you may want to display in your worksheet:

PDF Content:

No alt text provided for this image

Text File:

No alt text provided for this image

Web Content:

No alt text provided for this image

Worksheet uses HTML templates to display contents in worksheet.

HTML templates to display are stored in below path for version 22.1:

C:\Program Files\ANSYS Inc\v221\aisol\DesignSpace\DSPages\html

Hence, you can use the below code to display web, txt or pdf contents :

import toolbar
toolbar.ToggleWorksheetVisibility(ExtAPI)
WorksheetPane = ExtAPI.UserInterface.GetPane(MechanicalPanelEnum.Worksheet)
WorksheetPane.Caption = "my content"
WorksheetPane.CloseButtonVisible = True
control = WorksheetPane.ControlUnknown
control.Navigate(r"Your\path\to\text\file\mytext.txt") #for Text content
#control.Navigate(r"Your\path\to\pdf\file\mypdf.pdf")#for PDF content
#control.Navigate("www.google.com")#for web content        

Do YOU have a Script Tip to share? Comment below and someone from Ansys will reach out to you to gather more information. We look forward to featuring YOU next!

要查看或添加评论,请登录

Ansys Structures的更多文章

社区洞察

其他会员也浏览了