Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Model.GetFaces

Status
Not open for further replies.

Creigbm

Mechanical
Aug 1, 2003
161
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.
 
Replies continue below

Recommended for you

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

Regards
 
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.



 
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

[bat]Due to illness, the part of The Tick will be played by... The Tick.[bat]
 
Thanks Tick, I think that is what I am looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor