another C# question
another C# question
(OP)
ok I'm getting into C# those days and here is my question:
works fine in one line, but:
is there a better way?
CODE --> VBA
CATIA.ActiveWindow.Layout = catWindowSpecsOnly
works fine in one line, but:
CODE --> C#
INFITF.Application myCatia = (INFITF.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Catia.Application");
INFITF.SpecsAndGeomWindow theWindow = (INFITF.SpecsAndGeomWindow) myCatia.ActiveWindow;
theWindow.Layout = (INFITF.CatSpecsAndGeomWindowLayout) 0 ; // the value of catWindowSpecsOnly is there a better way?
Eric N.
indocti discant et ament meminisse periti
indocti discant et ament meminisse periti





RE: another C# question
CODE --> C#
indocti discant et ament meminisse periti
RE: another C# question
Regards,
Jenia Ladkov
RE: another C# question
As per CATIA, I mostly use the chm file.
for help I use my best friend DuckDuckGo
indocti discant et ament meminisse periti
RE: another C# question
The good thing is I can connect to Catia V5
Regards,
Jenia Ladkov
RE: another C# question
CODE --> C#
namespace CatiaV5HideShowManager { /// <summary> /// Interaction logic for HideElements.xaml /// </summary> public partial class HideShowCatiaV5GeoElements : UserControl { private BackgroundWorker bgWorker = new BackgroundWorker(); public event EventHandler BackgroundWorkerCompleted; static INFITF.Application myCatia; static INFITF.Document myDoc; static INFITF.Document myProductDoc; static INFITF.Selection mySelection; static INFITF.VisPropertySet myVisProperties; public HideShowCatiaV5GeoElements() { InitializeComponent(); bgWorker.RunWorkerCompleted += delegate { OnBackgroundWorkerCompleted(); }; } private void OnBackgroundWorkerCompleted() { if (BackgroundWorkerCompleted != null) { BackgroundWorkerCompleted(this, null); } } public void HideAll_Click(object sender, RoutedEventArgs e) { try { myCatia = (INFITF.Application)Marshal.GetActiveObject("CATIA.Application"); } catch (Exception) { } myDoc = (Document)myCatia.ActiveDocument; myProductDoc = (Document)myCatia.ActiveDocument; mySelection = (Selection)myProductDoc.Selection; myVisProperties = (VisPropertySet)mySelection.VisProperties; mySelection.Search("CatPrtSearch.Surface,All"); myVisProperties.SetShow(CatVisPropertyShow.catVisPropertyNoShowAttr); mySelection.Clear(); } } }Sample application can be downloaded from https://github.com/OndrejMikulec/CatiaLubeGroove
Will be useful for those who want to switch to C#. I'm switching because of other applications and support where 99% of code written in C#.
Regards,
Jenia Ladkov
RE: another C# question
All of the support is written in vb. What advantages did you found using C#. Unfortunately, I don't know nothing of C#.
Tiago Figueiredo
Tooling Engineer
Youtube channel:
https://www.youtube.com/channel/UC1qdlBeJJEgMgpPLV...
RE: another C# question
.NET is available with C#, create DLL for reuse...
VBA code saved in database (3DX) for all to share
did you google "C# vs VBA" ?
also learning another code is always good...
indocti discant et ament meminisse periti
RE: another C# question
Tiago Figueiredo
Tooling Engineer
Youtube channel:
https://www.youtube.com/channel/UC1qdlBeJJEgMgpPLV...
RE: another C# question
Tesak
http://scripts4all.eu/txtoncurve/ - Text along a curve for Catia V5
RE: another C# question
Regards,
Jenia Ladkov
RE: another C# question
This is VB.net
CODE --> VB.Net
#Region "GET CATIA V5" Dim myCATIA As INFITF.Application On Error Resume Next myCATIA = CType(GetObject(, "CATIA.Application"), INFITF.Application) If Err.Number <> 0 Then myCATIA = CreateObject("CATIA.Application") myCATIA.Visible = True End If #End RegionCODE --> C#
public CatiaV5Connection() { InitializeComponent(); #region Check Catia V5 connection try { myCatia = (INFITF.Application)Marshal.GetActiveObject("CATIA.Application"); CatiaV5.Foreground = new SolidColorBrush(Colors.Green); Connected.Visibility = Visibility.Visible; Disconnected.Visibility = Visibility.Collapsed; CatiaV5.ToolTip = "Connected to Catia V5"; } catch (Exception) { Connected.Visibility = Visibility.Collapsed; Disconnected.Visibility = Visibility.Visible; CatiaV5.Foreground = new SolidColorBrush(Colors.Red); CatiaV5.ToolTip = "Not connected to Catia V5"; } #endregion }Regards,
Jenia Ladkov
RE: another C# question
https://stackoverflow.com/questions/9679375/run-an...
I have the feeling it could be a better solution as to start CATIA you might want to control the env and some other option using arguments in the command line
indocti discant et ament meminisse periti
RE: another C# question
Regards,
Jenia Ladkov