×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Selection search to array

Selection search to array

Selection search to array

(OP)
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!

RE: Selection search to array

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

https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...

RE: Selection search to array

(OP)
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.

RE: Selection search to array

(OP)
Actually they are made with the part design workbench since the company that I work for doesnt have the tube design workbench.

RE: Selection search to array

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

RE: Selection search to array

(OP)
I posted the whole problem in this thread:

Place points in a tube macro.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources