Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

CATIA VBSCRIPT planar sections an multiple apply

Status
Not open for further replies.

jissididi

Automotive
Mar 17, 2015
46
FR
Ok guys here is the problem, I'm trying to simplify my code to avoid unwanted mistakes to happen, because there are still problem using catia with the Sleep function(my computer sometimes is slow)
To simplify my code which is meant to create planar sections of an element using various planes, im currently transforming the code to call the planar section just once and not everytime i have a different plane.
BUT... Catia doesn't like it... at all

I can make the first section, make that the panel of planarSections stays activated but when I select another plane to apply the section on, it selects it but doesn't use it for the section ?!
If you have any idea to help me solve my problem I'll be gratefull.

Here is the code i use

Code:
CATIA.StartCommand "Planar Sections"

				WScript.Sleep 100

				oSelection.Search "Name=" & namer ' name of the element to apply the section on

				WScript.Sleep 200

				oSelection.Search "Name=plane0" 'selection of the first plane with which one will be applied the section

				WScript.Sleep 200

				for i=0 to 14    ' loop to reqch the apply button

					WshShell.SendKeys "{TAB}", TRUE

					WScript.Sleep 100

				Next

				WshShell.SendKeys "{ENTER}", TRUE  ''sendkey enter to "clic" on the apply button previously selected

				WScript.Sleep 400

				For j = 1 to (num-1)  ' loop to select the other planes created before this part of code an apply the section for all of them 

					oSelection.Clear

					WScript.Sleep 100

					oSelection.Search "Name=plane" & CLng(360/num*j)

					tggt = oSelection.count

					WScript.Sleep 200
					
					WshShell.SendKeys "{ENTER}", TRUE

					WScript.Sleep 200

				Next
				
				for i=0 to 15 'loop to reach the OK button

					WshShell.SendKeys "{TAB}", TRUE

					WScript.Sleep 100

				Next
		
				WshShell.SendKeys "{ENTER}", TRUE ' clic on OK button

				WScript.Sleep 100

				oSelection.Search "Name=" & "Planar Sections." & "*, all"  'select all the created sections to hide them

				WScript.Sleep 200

				Set VisPropertySet1 = oSelection.visProperties

				VisPropertySet1.SetShow 1 ' hidding the selcion

				WScript.Sleep 200

				oSelection.Clear
 
Replies continue below

Recommended for you

I found a solution

A bit tricky but, whatever... works just perfectly
I had just to activate the selection , and for that I used WshShell.SendKeys "c:FrmActivate" + "{ENTER}", True just after the selection

Code:
For j = 1 to (num-1)

					oSelection.Clear

					WScript.Sleep 100

					oSelection.Search "Name=plane" & CLng(360/num*j)

					WshShell.SendKeys "c:FrmActivate" + "{ENTER}", True

					WScript.Sleep 200

Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top