Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Selection search to array

Status
Not open for further replies.

Gilgamesh99

Automotive
Jun 11, 2013
45
MX
Hi:

Im trying to asign the elements of a selection search to an array in order to automatically find the edges of a solid and generate points. More specifically, the code for search selection is this:

Sub CATMain()

Dim objSel As Selection
Set objSel = CATIA.ActiveDocument.Selection
objSel.Search ("Type=Edge,all")
objcount = objSel.Count

MsgBox objcount

End Sub

What I need is to asign every element of the search to an array in order to extract the centers of some circles. Does anyone know how to acomplish such weird task?

Thank you in advance!
 
Replies continue below

Recommended for you

Hi,

I suggest you to check Mike Berry's blog, there is a post called "Easily display array values in a Msgbox for debugging" maybe will help you more (generally speaking, that blog is a golden mine for not professional programmers like us).

Of course you can get what you want with something like this.

For i = 1 To objcount
MsgBox objSel.Item(i).Name
Next

To extract the center of circles, depends on the type of the circle object (are they edges of something or sketches or ....).

Regards
Fernando

 
Thanks for the advice. I already have the array working as desired!. What I'm trying to do is a macro to create centerpoint on the edges of a tube and then export those points to excel. Unfortunately the code i figured out is also recognizing the wireframe:

Dim objSel As Selection
Set objSel = CATIA.ActiveDocument.Selection
objSel.Search ("Type=Edge,all")
objcount = objSel.Count


Is there any way to avoid the wireframe recognition? I attached an image for better explain myself.
 
 http://files.engineering.com/getfile.aspx?folder=96bf6600-ea60-4710-aefa-d8db2d052457&file=Tube.JPG
Actually they are made with the part design workbench since the company that I work for doesnt have the tube design workbench.
 
well, you can go in your array and feed the circle center point function, if it fails, then you don't need the point.

if you want to be very accurate, you can check the name of the element and find reference to the solid before you get the center point.

Eric N.
indocti discant et ament meminisse periti
 
I posted the whole problem in this thread:

Place points in a tube macro.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top