Archinect

Product Architecture Lab

 

Archived

Oct '11 - Feb '12

 
  • anchor

    My New Best Friend

    By Ben.Silverman
    Oct 10, '11 6:54 PM EST

    I've never been much of a reader of manuals. I prefer to tear open packaging, toss the manual to the side to never be seen again, and learn by doing (aka flailing hopelessly till my new toy works, breaks or I become bored). Typically an IKEA instruction booklet (the picture book of manuals) is the only manual that can keep my attention from beginning to near end. However the CATIA Automation Help is quickly becoming my new best friend.

    In PAE 810: Interoperability we are writing VB.NET programs to send data back and forth between various software packages. In class we are learning the principles of object oriented programming and the VB.NET framework to create the programs using Learning Visual Basic .Net by Jesse Liberty as a textbook (with little programming experience this book has been really helpful and has made programming a lot less intimidating for someone who nearly failed Java freshman year of college). In order to contact other software programs from VB.NET we reference the API (Application Programming Interface) of that software program. However once in the API of a software there is no textbook and the documentation becomes sparse if best which results in many many hours of exploration and frustration sifting through the languages.

    I am currently working on relaying geometric data from Catia to VB.NET to a text file. In order to do this my first step is to get the XYZ coordinates of each point of my wireframe geometry in Catia and store it in a variable in VB.NET. Utilizing some code I found in a forum discussion I was able to select a point in Catia and get its coordinates into a VB.NET variable. However, reading the XYZ's of points in a polyline has proven to be a much more difficult challenge for me. That's where my new best friend came in to save the day.  The Catia Automation Help is extremely cumbersome and not always directly helpful but its all I've got besides bits and pieces of forum discussions here and there across the internet. Forcing my way through its deep rooted trees of classes, objects, properties and methods, is painful but it has become necessary in order to gain control of Catia via VB.NET.

     

     

    After 4 hours or so going back and forth between the CATIA Automation Help and various forum discussions I have achieved a simple yet still gratifying victory of being able to read the coordinates of the points of a polyline. It took a lot of sifting through the document, but ultimately I wrote a little test program that could select a polyline in Catia, index through the points on the polyline, and retrieve the XYZ coordinates of each point on that polyline.The challenge for me was that the GetElement method for HybridShapePolyine (thats CATIA for polyline) returned a reference to the point rather than the actual point. It took me a couple of hours to realize that meant that I can not actually run one of the Point object's methods if it is only a reference as a reference is really just an arrow pointing at something in the system's memory. Eventually I came to the following solution: 

    • Get a reference to the Nth point of the polyline
    • Create a second point by referencing the reference to the Nth point of the polyline (thus the new point would have the same XYZ's as the point thats is being referenced)
    • Finally read the XYZ's of the new point
    • Loop through for each point on the polyline

    It seems incredibly redundant to create a point by referencing a reference to a point that has the same exact coordinates as the new point (and I am sure my professor will show me how to do it all in one line of code), but as a novice coder it feels pretty powerful to become your computer's master and talk directly to Catia and have it respond correctly to even as small of a request as reading point coordinates. 

     



     
    • No Comments

    • Block this user


      Are you sure you want to block this user and hide all related comments throughout the site?

      Archinect


      This is your first comment on Archinect. Your comment will be visible once approved.

    • Back to Entry List...
  • ×Search in:
 

About this Blog

The Product-Architecture Lab at Stevens Institute of Technology is a pioneering graduate program integrating the study of Architecture, Engineering, Product Design, and Interaction. The program focuses on a fusion of design culture and technology through the disciplines of computation, analysis, and advanced production methodologies.

Affiliated with:

Authored by:

  • Ben.Silverman

Other blogs affiliated with Stevens Institute of Technology:

Recent Entries