Encoding Catia scripts
Encoding Catia scripts
(OP)
Hi Gents,
A quick question.
Is it possible to encode small scripts to stop them being altered?
Regards
Alan
A quick question.
Is it possible to encode small scripts to stop them being altered?
Regards
Alan





RE: Encoding Catia scripts
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
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Encoding Catia scripts
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
RE: Encoding Catia scripts
For hta I'm using a free editor which can compile also the hta in exe file.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Encoding Catia scripts
I will try the two methods.
Regards
Alan
RE: Encoding Catia scripts
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
RE: Encoding Catia scripts
Hard to give advice without a clear input, CATIA.StartCommand is not the best way to do automation, check documentation please.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Encoding Catia scripts
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
--------------------------------------------------------------------------------------------------