Holes coordinates in a plate
Holes coordinates in a plate
(OP)
I have a rectangular plate (Catpart) with different holes in diameter and type.
I'd like to write a catscript that can extract the coordinates of all of them to a txt file sorted by Ø, x and y.
Does anybody have any idea of how can I get this? Any example or advice?
Thanks in advance
I'd like to write a catscript that can extract the coordinates of all of them to a txt file sorted by Ø, x and y.
Does anybody have any idea of how can I get this? Any example or advice?
Thanks in advance





RE: Holes coordinates in a plate
Did you solve this problem?
Regards
Fernando
RE: Holes coordinates in a plate
Do you have any suggestion?
RE: Holes coordinates in a plate
Eric post this catvba also in other forums if I remember correctly and I tested another version of this catvba in r18 and worked fine (I've modified only the path - if Eric agree and somebody wants I can post the catvba also here).
Regards
Fernando
RE: Holes coordinates in a plate
Do you know if your plate does have "hole' features or if those holes cn be defined by pocket, groove, BO, split (with surface)...???
May be you can select 1 by 1 all edges of the solid then create a cicle center point. If it works, you have (X,Y,Z) then get Ø . if it fails go next edge.
indocti discant et ament meminisse periti
RE: Holes coordinates in a plate
I will explain my case...
I have a simple rectangular plate (Catpart made with Part Design module) with lot of holes.
All holes were created with the command HOLE.
The Ø of them can be different, also their type... some threated, others counterbordered, etc.
The problem is that it is very slow to create the center point one by one and then extract the coordinates of each point, except if this operation could be managed automatically.
RE: Holes coordinates in a plate
Regards
Fernando
RE: Holes coordinates in a plate
Regards
Fernando
RE: Holes coordinates in a plate
The catvba and catscript that you sent are very interesting. Thank you very much.
I'll see what can I do with them, but I don't see clear how can I extract the Ø and hole type.
I'll continue trying.
Thanks again :)
RE: Holes coordinates in a plate
You should consider the money you will save with a script (CAA or VB/VBA) and what it costs.
The time you spend trying to get info and script that will never fit 100% of what you need might be precious, don't waste it.
indocti discant et ament meminisse periti
RE: Holes coordinates in a plate
I was looking for something else and an idea came to me..see the attachment...
For the hole type you have:
0 - simple
1 - tapered
2 - counterbored
3 - countersunk
4 - counterdrilled
You can improve the code, there is also in documentation (v5automation.chm file) a procedure to GetOrigin of the hole...if you can improve the code I would like to see how you handled...
Regarding your question about freezing CATIA when you use my CATScript for extrude text which I posted in COE forum...I have no idea...but I know if the text is long or fonts are complicated it will take long time to run...
Regards
Fernando
RE: Holes coordinates in a plate
Regards
Fernando
RE: Holes coordinates in a plate
I'll try to handle the code, but I am a beginner in scripting so it will takes time to me.
If I have any doubt, I'll ask you again.
Kind regards
RE: Holes coordinates in a plate
Sub catmain()
'get the selection object
Dim sel
Set sel = CATIA.ActiveDocument.Selection
'set up a selection filter
Dim fil(0)
fil(0) = "Hole"
'perform the selection
Dim ans
ans = sel.SelectElement2(fil, "Select a hole", False)
'check that selection was not cancelled
If ans <> "Normal" Then Exit Sub
'get the hole
Dim theHole As Hole
Set theHole = sel.Item(1).Value
Msgbox "Hole Name = " & theHole.Name
'need a variant object in order to use method returning array
Dim vHole As Variant
Set vHole = theHole
'get the origin of the hole using the variant object
Dim origin(2)
vHole.GetOrigin (origin)
Msgbox "Origin = " & origin(0) & ", " & origin(1) & ", " & origin(2)
End Sub
Regards
Fernando
RE: Holes coordinates in a plate
This is really interesting.
At the moment, I solved the problem by getting a Catdrawing with the holes coordinates, and then export each one to a txt file.
With your last suggestion, you opened me a door to a better solution, saving time on taking a Catdrawing.
I will play with your code and see if I finally make the application that I need.
Thank you very much again. Kind regards.