×
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

Model.GetFaces

Model.GetFaces

Model.GetFaces

(OP)
I am using this command in my macro to get all the faces in a sections.  Does anyone know how the .getfaces array works?  For example, if I have 3 faces, I want to break it up into three difference sets (Face1, Face2, Face3).  I tried to extract anything out of the array with no success.  Any ideas?

Thanks.

RE: Model.GetFaces

Have you tried SW API help? Take a look at the examples. Wich portion of your code is failing?

Regards

RE: Model.GetFaces

(OP)
I have checked out the API help and it doesn't have much when it comes to '.getfaces'.  This is what I am trying to do:

CODE

Set swSelMgr = Part.SelectionManager
selType = swSelMgr.GetSelectedObjectType2(1)
Set selEntity = swSelMgr.GetSelectedObject3(1)
Set swModelExt = Part.Extension

Faces = selEntity.GetFaces()
FaceCount = selEntity.GetFaceCount()

From here I want to be able to get the select the first face.  I believe it has something to do with the Selection Manager in SW but not sure.   Thanks for your help.



  

RE: Model.GetFaces

GetFaces applies to the Feature object, not the ModelDoc object.

You need to traverse faces with commands Body2.GetFirstFace and Face2.GetNextFace.

I have an example in an addin tutorial I plan to post this weekend.  This is a small excerpt.  I use a program to randomly color all faces as a jumping-off point to illustrate how to turn an .exe into an addin .dll in VB.  Excerpt below.  Hope it helps.

CODE

For I = LBound(swBodies) To UBound(swBodies)
    Set swBody = swBodies(I)
    Set swFace = swBody.GetFirstFace
    Do While Not swFace Is Nothing
        RandomColor = swBasicColors(Int(swBasicColorCount * Rnd))
        retBool = swFace.Select3(False, 0, retObj)
        retBool = ThisPart.Model.SelectedFaceProperties(RandomColor, CDbl(pProps(3)), CDbl(pProps(4)), _
            CDbl(pProps(5)), CDbl(pProps(6)), CDbl(pProps(7)), CDbl(pProps(8)), _
            False, vbNullString)
        Set swFace = swFace.GetNextFace
    Loop
Next

Due to illness, the part of The Tick will be played by... The Tick.
http://www.EsoxRepublic.com

RE: Model.GetFaces

(OP)
Thanks Tick, I think that is what I am looking for.

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