Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

CATScript/VBA for Sketch Analysis

Status
Not open for further replies.

2briancox

Aerospace
Dec 22, 2014
34
0
0
US
Does anyone know of a way to use a macro in CATIA V5 R23/24 to activate and read the results from a Sketch Analysis on a CATDrawing?

I would like to end or perhaps pause a script if the geometry is open.
 
Replies continue below

Recommended for you

There is a tool withing the Drafting Workbench of CATIA (when you open a CATDrawing) called Sketch Analysis. It reports how many profiles there are and whether they are Closed Profiles (such as a polygon or circle) or Open Profiles (such as an arc, spline or line).

I want to activate that tool and read its output using CATScript.
 
Thank you, Fernando. I'll give that a try when I return to work. Do you know what the return type of ”Sketch Solving Status” is?
 
If I wanted a macro to read in the lines of output from that window, would you know how to go about that?

Ultimately I'm trying to achieve diverging like:

If more than one profile or profile1 is open then
Prompt the use to fix the profile
Pause the macro
End If
 
I apologize for that last post. My phone thinks it knows what I'm trying to say and often gets it wrong.

I'm trying to achieve something like this:

If there is more than 1 profile or profile1 is open then
Prompt the user to fix the geometry
Pause the macro until they do
Check again
End if
 
Fernando,

This fix worked to open up the Sketch Analysis window. Thank you!

Do you know if there's a way to read in the data that it puts out into VBA? I'm trying to avoid human interaction if possible here.

Thanks again.
 
Ha! Very funny. Our designers are unfortunately spending too much time looking at every single DXF, when they only need to fix the ones that have geometry that is not closed. Tedious.

Anyway, do you think this might be approachable through CAA or some other means?

I don't think you can use the search tools to find out if some geometry is open or closed. Or can you?
 
I would look into this:

try to make a pad from your sketch => if error tell user to fix

search all face in pad, define a new reference with first face.

trim (remove lumb) with ref face, then try to get volume, if you have one then profile is not single profile => ask user to fix

remove trim, remove pad

Eric N.
indocti discant et ament meminisse periti
 
Thank you, Eric. That sounds like a very workable idea! I don't yet know how to do much of what you explained but I get the concept and I'll research it.

Perhaps you could just explain one question. What do you mean by trim (remove lumb)?
 
I understand. And thank you for your suggestion. I will look that up when I need it, although I've realized I really just need to know if the shape is made without error. Quantity of bodies can be ignored for now.

However, I cannot get the Copy-Paste method to work. When I record the copy and paste within the "Record Macro", I get the copy, but the paste is just a list of the items created manually. So, the copy works fine. But .Paste is not a method of Factory2D or Sketch. I am assuming that I have to create a reference of the "Copy", but I'm not exactly clear from the documentation I have on how to put that reference into a part sketch. Is there a link someone has that explains it clearly?
 
Scratch that. I was trying to search for, then copy-paste all of the geometry. I switched to copy-paste the view, and it all worked out fine. SOLVED!
 
Status
Not open for further replies.
Back
Top