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!

Encoding Catia scripts

Status
Not open for further replies.

Alan Lowbands

Aerospace
May 17, 2017
274
GB
Hi Gents,
A quick question.
Is it possible to encode small scripts to stop them being altered?

Regards
Alan
 
Replies continue below

Recommended for you

For catvbs you can obfuscate directly in CATIA, CATScripts no solution, catvba you can put a password.

None of them are very secure, for someone with enough knowledge they can be brake.

More secure is creation of exe files in a programming environment (like vb.net for example).

You can also embed your CATScript or catvbs code in a hta file and make it also exe file.

Regards
Fernando

- Romania
- EU
 
Thanks Fernando,

I'm getting some translations done and the scripts are named in English but add the German translation.
For example, cap head screw.catscript would add a text box with the German text.
Once there all finished I just didn't want anyone changing anything as a prank.
People could end up putting anything on a few hundred drawings :)

I'll take a look at the hta file and see how involved that will be to do.

Cheers
Alan
 
I would convert CATScripts in catvbs and obfuscate them. You really need some knowledge to unobfuscate them (please correct me if I'm not using the right word for doing the reverse of obfuscation, English is not my native language).

For hta I'm using a free editor which can compile also the hta in exe file.



Regards
Fernando

- Romania
- EU
 
Hi,
Another quick one please ( I know I'm becoming a pain :()
As I said I'm using bits of scripts to insert text but I also have a few which change the annotation on some dimensions.
I usually just dimension, say a hole. Highlight it then run a little script to fill in the details.
I have tried to use the Catina start command to try and do the whole thing from scratch
So I just run the script and then click the feature and it will dimension and autofill the annotations I want but I can't get it to work.
Any ideas ?
Thanks
Alan
 
If you have several scripts which you run one after another, you can put them all in a single one. If you want to repeat this, put the actions in a loop and do the job till you push ESC key (there are examples here on the forum).

Hard to give advice without a clear input, CATIA.StartCommand is not the best way to do automation, check documentation please.

Regards
Fernando

- Romania
- EU
 
Thanks Ferdo.
Here's what I mean,
If I use the catia start command for selecting the dimension it doesn't insert the annotation.
The command may not work that way so I could be flogging a dead horse :(


----------------------------------------------------------------------------------------
Sub CATMain()

Dim documents1
Set documents1 = CATIA.Documents

Set Document = CATIA.ActiveDocument


CATIA.StartCommand "Diameter Dimensions"


Dim selection1
Set selection1 = Document.Selection

Set Info = selection1.Item(1)

Dim Dimension1
Set Dimension1 = Info.Value

Dim DimDimValue
Set DimDimValue = Dimension1.GetValue

DimDimValue.SetFormatName 1, "ANS.DIMM"
DimDimValue.SetFormatPrecision 1, "0.0010" 'precision

Dim oBefore
'oBefore ="Before"

Dim oAfter
oAfter ="-H7 THRO'"

Dim oUpper
'oUpper = "Upper"

Dim oLower
'oLower = "Lower"

Dimension1.GetValue.SetBaultText 1, oBefore, oAfter, oUpper, oLower

Dim myDim 'As DrawingDimension
Set myDim = CATIA.ActiveDocument.Selection.Item(1).Value
Dim myDimLine 'As DrawingDimLine
Set myDimLine = myDim.GetDimLine
myDimLine.DimLineGraphRep = catDimLine2Parts

MyDim.RestoreValuePosition()


End Sub

--------------------------------------------------------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top