Page 1 of 1

AddPolyfaceMesh method

Posted: Tue Feb 04, 2003 8:51 am
by andreadiloreto
How can I use the AddPolyFaceMesh method to draw a mesh surface?

Posted: Tue Feb 04, 2003 10:03 pm
by John Finlay
There are two errors in the Help for PolyFaceMesh, Both the Method and Example are wrong.

Try:

Private Sub AddPolyfaceMeshExample()

' This example creates and adds a polyface mesh to the drawing.
Dim faceObj As IntelliCAD.PolyfaceMesh
Dim icadDoc As IntelliCAD.Document
Dim Pt1 As IntelliCAD.Point
Dim Pt2 As IntelliCAD.Point
Dim Pt3 As IntelliCAD.Point
Dim Pt4 As IntelliCAD.Point
Dim myPoints As Points
Dim myObj As Object

Set icadDoc = ActiveDocument

' Define the four coordinates of the face
Set myPoints = Library.CreatePoints
Set Pt1 = Library.CreatePoint(0, 0, 0)
myPoints.Add
myPoints(myPoints.Count).x = Pt1.x
myPoints(myPoints.Count).y = Pt1.y
myPoints(myPoints.Count).z = Pt1.z

Set Pt2 = Library.CreatePoint(0, 2, 0)
myPoints.Add
myPoints(myPoints.Count).x = Pt2.x
myPoints(myPoints.Count).y = Pt2.y
myPoints(myPoints.Count).z = Pt2.z

Set Pt3 = Library.CreatePoint(2, 2, 0)
myPoints.Add
myPoints(myPoints.Count).x = Pt3.x
myPoints(myPoints.Count).y = Pt3.y
myPoints(myPoints.Count).z = Pt3.z

Set Pt4 = Library.CreatePoint(2, 0, 0)
myPoints.Add
myPoints(myPoints.Count).x = Pt4.x
myPoints(myPoints.Count).y = Pt4.y
myPoints(myPoints.Count).z = Pt4.z


Dim LOFIndices(0 To 4) As Long
LOFIndices(0) = 1
LOFIndices(1) = 2
LOFIndices(2) = 3
LOFIndices(3) = 4


' Add the 3DFace object

Set faceObj = icadDoc.ModelSpace.AddPolyfaceMesh(myPoints, LOFIndices)

' DEFINE ADDITIONAL FACE INFO HERE

faceObj.Update

ThisDocument.ActiveViewport.ZoomExtents

End Sub

This just draws a rectangle and I'm sure this will get you started.



------------------
Regards
John Finlay

Posted: Wed Feb 05, 2003 7:13 pm
by John Finlay
Andrea also sent me an email and I directed him to my post above.

He sent this reply email:

[Quote]
Thank you, now the code is Ok!

Andrea Di Loreto
[End Quote]