Automatic report generation by tcl/tk and API in hyperview
hi, guys!
In hyperview, I want to generate the report by tcl commands. But in the class hierarchy, I couldn't find the way of defining the handle about ppt (hwIPPTPublish_handle). It is appreciate for you to help me solve this problem.
Thank you very much.
Answers
-
Its in the session class. Attached is a sample script that shows using PPTPublish handle
hwi GetSessionHandle sessionH
sessionH GetPublishingHandle pub
set pfadPPT 'D:/tmp/test.ppt' catch { sessionH ReleaseHandle } catch { pub ReleaseHandle } catch { ppt ReleaseHandle } hwi OpenStack hwi GetSessionHandle sessionH sessionH GetPublishingHandle pub pub GetPPTPublishHandle ppt ppt SetDestination new ppt SetPathOnDisk $pfadPPT ppt Publish ppt SaveLinkedPPTPresentation $pfadPPT ppt CloseLinkedPPT hwi CloseStack
0 -
Hi, Livil Lyle.
Thanks for your answer. I also thinks that it is in the session class. But I could not find this command--GetPPTPublishHandle. When I try to use this command, the system shows the message that 'Object named: sessionH (of type hwISession) could not find requested method: GetPublishingHandle. Or the method was called with incorrect arguments.' The version that I use is 14.0. I have no idea how to solve this problem. It is appreciate for you to help me in this aspect.
0 -
Hi Shi,
I didn't have this issue in Hyperworks 14.0.133.
Regards,
Livil Lyle
0 -
Hi Livil Lyle,
When I try it in the version 17 again, it is ok. Thank you very mush.
Regards,
Shi Feng
0 -
I am very new to TClLfunction coding below is code which i modified according to my requirement now I want to directly publish the images to PPT directly, i tried including above commands (macro is not pasted) but it is inserting picture for one loadcase I have 4 loadcases, is there way to make below macro work for mulitple loadcases.
#=================================================================================
# HyperView and then save it under the current working directory.
# THIS MACRO CREATES PUT PICTURE CURRENT FOLDER
# THIS CAN TAKES STRESS & DISPLACEMENT PLOTS
# USER NEED READ MACRO AND UPDATE INPUTS IN CONSOLE WINDOW
# USER HAVE BEEN FLEXIBILITY TO SELECt THE PARAMETERS
# IT TAKES PICTURE FOR DIFFERENT LOADCASES AT DIFFERENT ANGLE NOW It iS SET TO 45
#=================================================================================
namespace eval ::compQuery {
}
proc ::compQuery::GetcompVar { args } {set t [::post::GetT];
#set he [string map {. '' ' ' ''} '[clock seconds][expr rand()]']## Releasing all handles
hwi ReleaseAllHandles;
hwi OpenStack
## Getting the session, project handles along with current working directory
hwi GetSessionHandle sh
set dirName [sh GetSystemVariable 'CURRENTWORKINGDIR']
sh GetProjectHandle ph
## Getting the page handle and the no. of pages in the session
for {set i 1} {$i <= [ph GetNumberOfPages]} {incr i} {
hwi OpenStack
ph GetPageHandle pgh$t $i
pgh$t GetAnimatorHandle animh$t
## Getting the window handle and no of windows in each page
for {set j 1} {$j <= [pgh$t GetNumberOfWindows]} {incr j} {
hwi OpenStack;
pgh$t GetWindowHandle wh$t $j
wh$t GetViewControlHandle vh$t
## Making sure the client is Animation and that the window is not empty
if {[wh$t GetClientType] != 'Animation' } {
::hw::ShowMessage 'Animation Client is not loaded on pg${i}win${j}, continuing with the next one'
hwi CloseStack;
continue;
}
if {[wh$t IsEmpty] == 'true' } {
::hw::ShowMessage 'pg${i}win${j} is empty, continuing with the next one'
hwi CloseStack;
continue;
}
wh$t GetClientHandle posth$t
## Getting active model handle along with result and contour handles
posth$t GetModelHandle mh$t [posth$t GetActiveModel]
mh$t GetResultCtrlHandle resh$t
resh$t GetContourCtrlHandle ch$t
ch$t GetLegendHandle lh$t
## Setting datatype, datacomponent and the layer
set dType [ch$t GetDataType]
ch$t SetDataType $dType
set dComp [ch$t GetDataComponent]
ch$t SetDataComponent $dComp;
set layer [ch$t GetLayer]
ch$t SetLayer $layer
set System [ch$t GetResultSystem]
ch$t SetResultSystem $System
set Position [lh$t GetPosition]
lh$t SetPosition $Position
#set Position [lh$t GetNumericFormat]
#lh$t SetNumericFormat $NumericFormat
## Finding the subcase list and going over each subcase to set the desired query items
set subcase_num [resh$t GetSubcaseList]
foreach subcase $subcase_num {
resh$t SetCurrentSubcase $subcase
set simu_num [resh$t GetNumberOfSimulations $subcase]
for {set k 0} {$k < $simu_num} {incr k} {
set simu_label ''
set simu_label [resh$t GetSimulationLabel $subcase $k]
resh$t SetCurrentSimulation $k
tk_messageBox -message 'ENTER ONE STRESS, TWO DISPLACEMENT'
puts 'ENTER ONE OR TWO'
set x [gets stdin]
switch $x {
ONE {
ch$t SetDataType 'STRESS'
tk_messageBox -message 'ENTER vonMises,Tresca,P1 or P3'
puts 'vonMises or Tresca'
set i [gets stdin]
switch $i {
vonMises {
ch$t SetDataComponent 'vonMises'
}
Tresca {
ch$t SetDataComponent 'Tresca'
}
P1 {
ch$t SetDataComponent 'P1(major)'
}
P3 {
ch$t SetDataComponent 'P3(minor)'
}
}
ch$t SetLayer 'Max'
ch$t SetAverageMode 'SIMPLE'
ch$t SetResultSystem 0
}
TWO {
ch$t SetDataType 'DISPLACEMENT'
ch$t SetDataComponent 'Mag'
ch$t SetResultSystem 0
}
}
ch$t SetEnableState true
lh$t SetVisibility true
lh$t SetPosition Topleft
lh$t SetNumericPrecision 3
lh$t SetNumericFormat fixed
lh$t GetMinMaxVisibility true
posth$t SetDisplayOptions contour true
posth$t SetDisplayOptions legend true
posth$t Draw
pgh$t Draw
##vh$t FitAllFrames
set ::compQuery:::rotAngle 90 ;
for {set i 1} {$i <= [expr 360/$::compQuery::rotAngle]} {incr i} {
vh$t RotateRight $::compQuery::rotAngle;
##vh$t Fit ;
posth$t Draw ;
sh CaptureScreen JPEG '$dirName/page${i}win${j}subcase{$subcase}tstep{$k}.jpg' 70
#puts $filepath ;
}
}
}
::hw::ShowMessage 'Images are successfully captured and are located at: $dirName'
hwi CloseStack;
}
hwi CloseStack;
}
hwi CloseStack;
}
::compQuery::GetcompVar0