×
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

Anyone know how to create a counter selection

Anyone know how to create a counter selection

Anyone know how to create a counter selection

(OP)
Hi friends

I try to create a script that count the select that I click

I have a rectangular prismatic, that have 6 faces

I want that if I click in 5 faces, the count show me a message where appears numer 5, and if I click in 3 faces, show me 3


Thanks

RE: Anyone know how to create a counter selection

Dim oSelection As Selection
Dim theComponent As Product
Set oSelection = CATIA.ActiveDocument.Selection
MsgBox(oSelection.Count)

that should do

Eric N.
indocti discant et ament meminisse periti

RE: Anyone know how to create a counter selection

(OP)
This script Work
A lot of thanks itsmyjob


Sub selecFace()

UserForm1.Hide

Dim Language As String
Language = "VBSCRIPT"

Dim colDocum As Documents
Dim DocActivo As Document


Dim Status As String
Dim myselection As Selection
Dim InputObjectType(0)
InputObjectType(0) = "AnyObject"
Dim refBorde As Reference

Set DocActivo = CATIA.ActiveDocument

Set myselection = DocActivo.Selection

Dim sel
Set sel = CATIA.ActiveDocument.Selection
sel.Clear
Dim total As Double

Dim cont As Integer
cont = 0

Dim TheMeasurable As Measurable
Dim TheSPAWorkbench As Workbench
Dim refBody

MsgBox "Select the face and click ESC to finish "
While cont <= 88
Status = sel.SelectElement2(InputObjectType, "Select the faces: ", True)


If (Status = "Cancel") Then
Exit Sub
End If

Dim oSelection As Selection
Dim theComponent As Product
Set oSelection = CATIA.ActiveDocument.Selection
Set refBody = myselection.Item(1).Value

total = oSelection.Count

sel.Clear
Wend

UserForm1.Show

This script work for my project, I hope that can you help anybody that try the same

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