CATSCRIPT and Digitized Shape Editor (DSE lic)
CATSCRIPT and Digitized Shape Editor (DSE lic)
(OP)
Hi everyone,
I'm trying to write a macro for Catia V5 R22 to automate the creation of several planar sections with DSE licence.
But I Can't find the command to do this, it seems like the only thing that I can do with macro is automate the creation of elements from Generative Shape Design workbench.
Can you help me out ?
Bes regards
Jissididi
I'm trying to write a macro for Catia V5 R22 to automate the creation of several planar sections with DSE licence.
But I Can't find the command to do this, it seems like the only thing that I can do with macro is automate the creation of elements from Generative Shape Design workbench.
Can you help me out ?
Bes regards
Jissididi





RE: CATSCRIPT and Digitized Shape Editor (DSE lic)
RE: CATSCRIPT and Digitized Shape Editor (DSE lic)
CATIA.StartCommand "Planar Sections"
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: CATSCRIPT and Digitized Shape Editor (DSE lic)
and have you an idea of how you do to chose the cloud of points you want to apply the planar section on using its name and the name of the plane you will use ?
I read something about it at this adress : https://v5vb.wordpress.com/2010/01/20/startcommand...
but as I didn´t find any list of all the commands and syntax used on catia, Im kind of blocked...
Thanks again
RE: CATSCRIPT and Digitized Shape Editor (DSE lic)
In fact, I call the Planar Section command, and then I select both of the parameters I need to make the section
CODE -->
Dim oSelection as Selection Set oSelection = CATIA.ActiveDocument.Selection Dim namer As String namer = Inputbox("Please enter the EXACT name of the Point Cloud you want to divide.") oSelection.Search "Name=" & namer & "*,all" Dim oSelection2 as Selection Set oSelection2 = CATIA.ActiveDocument.Selection Dim j As Integer Dim k As Integer For j = 0 To 9 CATIA.StartCommand "Planar Sections" oSelection.Search "Name=" & namer & "*,all" oSelection2.Search "Name=" & "plane" & j & "*,alBut now I have a new problem : I have to clic on the apply button after each selection and finaly on the ok button but I don`t now how to do it ^^
Any idea ?
RE: CATSCRIPT and Digitized Shape Editor (DSE lic)
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: CATSCRIPT and Digitized Shape Editor (DSE lic)
so I ve been looking around for this sendkeys command,
but it looks like using Catscript to code, it doesn t work... :/
do you have any other idea or I just might be writing it bad?
RE: CATSCRIPT and Digitized Shape Editor (DSE lic)
I found some examples on the internet but couldn't make them work
CODE -->
Language="VBSCRIPT" Sub CATMain() Dim WSShell Set WSShell = CreateObject(“WScript.Shell”) Set partDocument1 = CATIA.ActiveDocument Set part1 = partDocument1.Part Set hybridBodies1 = part1.HybridBodies Set hybridBody1 = hybridBodies1.Add() hybridBody1.name = "geometrical set number 1" part1.InWorkObject = hybridBody1 Set hybridShapeFactory1 = part1.HybridShapeFactory Set axisSystems1 = part1.AxisSystems Set axisSystem1 = axisSystems1.Item("Absolute Axis System") For i = 0 To 9 Set reference1 = part1.CreateReferenceFromBRepName("RSur:(Face:(Brp:(AxisSystem.1;2);None:();Cf11:());WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", axisSystem1) Set reference2 = part1.CreateReferenceFromBRepName("REdge:(Edge:(Face:(Brp:(AxisSystem.1;3);None:();Cf11:());Face:(Brp:(AxisSystem.1;2);None:();Cf11:());None:(Limits1:();Limits2:());Cf11:());WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", axisSystem1) Set hybridShapePlaneAngle1 = hybridShapeFactory1.AddNewPlaneAngle(reference1, reference2, i, False) hybridShapePlaneAngle1.ProjectionMode = False hybridBody1.AppendHybridShape hybridShapePlaneAngle1 part1.InWorkObject = hybridShapePlaneAngle1 Set ItemToRename =hybridShapePlaneAngle1 ItemToRename.Name ="plane" & i Next part1.Update Set oSelection = CATIA.ActiveDocument.Selection namer = Inputbox("First, please make sure that you activated the DSE licence for CATIA (Tools/Option/General/Shareable Products), then, Please enter the EXACT name of the Point Cloud you want to divide.") oSelection.Search "Name=" & namer & "*,all" Set oSelection2 = CATIA.ActiveDocument.Selection For j = 0 To 9 CATIA.StartCommand "Planar Sections" oSelection.Search "Name=" & namer & "*,all" oSelection2.Search "Name=" & "plane" & j & "*,all" For k = 0 to 14 'CATIA.RefreshDisplay = True WSShell.SendKeys “c:FrmActivate” WSShell.SendKeys “{TAB}” Next For k = 0 to 15 'CATIA.RefreshDisplay = True WSShell.SendKeys “c:FrmActivate” WSShell.SendKeys “{ENTER}” Next NextRE: CATSCRIPT and Digitized Shape Editor (DSE lic)
CODE -->
Language="VBSCRIPT" Sub CATMain() Set WshShell = WScript.CreateObject("WScript.Shell") WScript.sleep 200 WshShell.SendKeys WScript.Arguments.Unnamed(0) ' if input to enter WshShell.SendKeys "{ENTER}" Set partDocument1 = CATIA.ActiveDocument Set part1 = partDocument1.Part Set hybridBodies1 = part1.HybridBodies Set hybridBody1 = hybridBodies1.Add() hybridBody1.name = "geometrical set number 1" part1.InWorkObject = hybridBody1 Set hybridShapeFactory1 = part1.HybridShapeFactory Set axisSystems1 = part1.AxisSystems Set axisSystem1 = axisSystems1.Item("Absolute Axis System") For i = 0 To 9 Set reference1 = part1.CreateReferenceFromBRepName("RSur:(Face:(Brp:(AxisSystem.1;2);None:();Cf11:());WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", axisSystem1) Set reference2 = part1.CreateReferenceFromBRepName("REdge:(Edge:(Face:(Brp:(AxisSystem.1;3);None:();Cf11:());Face:(Brp:(AxisSystem.1;2);None:();Cf11:());None:(Limits1:();Limits2:());Cf11:());WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", axisSystem1) Set hybridShapePlaneAngle1 = hybridShapeFactory1.AddNewPlaneAngle(reference1, reference2, i, False) hybridShapePlaneAngle1.ProjectionMode = False hybridBody1.AppendHybridShape hybridShapePlaneAngle1 part1.InWorkObject = hybridShapePlaneAngle1 Set ItemToRename =hybridShapePlaneAngle1 ItemToRename.Name ="plane" & i Next part1.Update Set oSelection = CATIA.ActiveDocument.Selection namer = Inputbox("First, please make sure that you activated the DSE licence for CATIA (Tools/Option/General/Shareable Products), then, Please enter the EXACT name of the Point Cloud you want to divide.") oSelection.Search "Name=" & namer & "*,all" Set oSelection2 = CATIA.ActiveDocument.Selection For j = 0 To 9 CATIA.StartCommand "Planar Sections" oSelection.Search "Name=" & namer & "*,all" oSelection2.Search "Name=" & "plane" & j & "*,all" For k = 0 to 14 WshShell.SendKeys "{TAB}" Next For k = 0 to 15 WshShell.SendKeys "{ENTER}" Next Next part1.Update End SubRE: CATSCRIPT and Digitized Shape Editor (DSE lic)
On Error Resume Next
Dim CATIA '', WScript As New Object
CATIA = GetObject("", "CATIA.Application")
Then, before or after SendKeys, depending on what you want, you need a waiting time to let CATIA to write in the power input and launch the commands. There are few threads here about this and the problems comming using this tehniques. That post on Mike Berry's blog is very useful.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: CATSCRIPT and Digitized Shape Editor (DSE lic)
One vbs file as one created with notepad witch will call the sendkeys inside catia ?
and One catvbs to choose the parameters ?
I wrote this, there is no more error message but it seems like the sendkeys"¨TABÇ" and ENTER doesnt work well, maybe a problem of timer as you said or is there something wrong before ?
code of vbs file whos name is CMD_APPLIER_PLANAR_SECTIONS
CODE -->
Set WshShell = WScript.CreateObject("WScript.Shell") WScript.Sleep 6000 WshShell.AppActivate "CATIA V5" WScript.Sleep 6000 for i=0 to 11 WshShell.SendKeys "{TAB}", TRUE WScript.Sleep 6000 Next WshShell.SendKeys "{ENTER}", TRUE WScript.Sleep 6000 for i=0 to 15 WshShell.SendKeys "{TAB}", TRUE WScript.Sleep 6000 Next WshShell.SendKeys "{ENTER}", TRUE WScript.Sleep 6000Code of catvbs :
CODE -->
Language="VBSCRIPT" Sub CATMain() Set partDocument1 = CATIA.ActiveDocument Set part1 = partDocument1.Part Set hybridBodies1 = part1.HybridBodies Set hybridBody1 = hybridBodies1.Add() hybridBody1.name = "geometrical set number 1" part1.InWorkObject = hybridBody1 Set hybridShapeFactory1 = part1.HybridShapeFactory Set axisSystems1 = part1.AxisSystems Set axisSystem1 = axisSystems1.Item("Absolute Axis System") num = Inputbox("Please chose the step to divide the model") For i = 0 To (180/num-1) Set reference1 = part1.CreateReferenceFromBRepName("RSur:(Face:(Brp:(AxisSystem.1;2);None:();Cf11:());WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", axisSystem1) Set reference2 = part1.CreateReferenceFromBRepName("REdge:(Edge:(Face:(Brp:(AxisSystem.1;3);None:();Cf11:());Face:(Brp:(AxisSystem.1;2);None:();Cf11:());None:(Limits1:();Limits2:());Cf11:());WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", axisSystem1) Set hybridShapePlaneAngle1 = hybridShapeFactory1.AddNewPlaneAngle(reference1, reference2, (num*i), False) hybridShapePlaneAngle1.ProjectionMode = False hybridBody1.AppendHybridShape hybridShapePlaneAngle1 part1.InWorkObject = hybridShapePlaneAngle1 Set ItemToRename =hybridShapePlaneAngle1 ItemToRename.Name ="plane" & i Next part1.Update Set oSelection = CATIA.ActiveDocument.Selection namer = Inputbox("First, please make sure that you activated the DSE licence for CATIA (Tools/Option/General/Shareable Products), then, Please enter the EXACT name of the Point Cloud you want to divide.") oSelection.Search "Name=" & namer & "*,all" Set oSelection2 = CATIA.ActiveDocument.Selection For j = 0 To (180/num-1) CATIA.StartCommand "Planar Sections" oSelection.Search "Name=" & namer & "*,all" oSelection2.Search "Name=" & "plane" & j & "*,all" cmd = "wscript T:\JDarsu\CMD_APPLIER_PLANAR_SECTIONS.vbs" Next part1.Update End Sub