본문 바로가기
  • Welcome!
VBA, VB.NET For Creo

IpfcSurface

by ToolBOX01 2024. 12. 16.
반응형

□ IpfcSurface

IpfcSurface is an interface in Creo Parametric that defines a surface. It provides a set of methods and properties to interact with and analyze surfaces within the software.

▷Key Properties:

IsVisible: A boolean indicating whether the surface is visible or not.
OwnerQuilt: The quilt (a collection of surfaces and curves) that the surface belongs to.

Code : IsVisible

 Dim ModelItemOwner As IpfcModelItemOwner
 Dim ModelItems As IpfcModelItems
 Dim Surface As IpfcSurface
 Dim i As Long
 
 Set ModelItemOwner = Model
 Set ModelItems = ModelItemOwner.ListItems(EpfcModelItemType.EpfcITEM_SURFACE)
 
  For i = 0 To ModelItems.Count - 1
  		Set Surface = ModelItems(i)
        magbox Surface.IsVisible
  
  Next i

 

Code : Returns the feature which contains the geometry ( feature Number )

Dim ModelItemOwner As IpfcModelItemOwner
Dim ModelItems As IpfcModelItems
Dim Surface As IpfcSurface
Dim Quilt As IpfcQuilt
Dim Feature As IpfcFeature
Dim i As Long
 
Set ModelItemOwner = Model
Set ModelItems = ModelItemOwner.ListItems(EpfcModelItemType.EpfcITEM_SURFACE)
 
  For i = 0 To ModelItems.Count - 1
        Set Surface = ModelItems(i)
        set Quilt = Surface.OwnerQuilt
        set Feature = Quilt.GetFeature
        Msgbox Feature.Number
  Next i

▷ Key Methods:

1. Evaluation Methods:

  • Eval3DData:
    Evaluates the surface at a specific UV point, returning XYZ coordinates, derivatives, and the normal vector.
  • EvalArea: Calculates the surface area.
  • EvalClosestPoint: Finds the closest point on the surface to a given point in 3D space.
  • EvalDiameter: Calculates the diameter of the surface at a specific UV point.
  • EvalMaximum/Minimum: Finds the maximum or minimum point on the surface in a given direction.
  • EvalParameters: Finds the UV coordinates corresponding to a given 3D point on the surface.
  • EvalPrincipalCurv: Calculates the principal curvatures and directions at a specific UV point.

2. Geometric Information Methods:

  • GetFeature: Returns the feature that the surface belongs to.
  • GetNURBSRepresentation:Converts the surface to a NURBS representation.
  • GetOrientation: Returns the orientation of the surface.
  • GetSurfaceDescriptor: Returns a data object describing the surface's geometry.
  • GetSurfaceType: Returns the type of the surface (e.g., planar, cylindrical, spherical).
  • GetUVExtents: Returns the minimum and maximum UV coordinates of the surface.
  • GetXYZExtents: Returns the minimum and maximum XYZ coordinates of the surface.

3. Topological Methods:

  • ListContours: Lists all contours on the surface.
  • ListSameSurfaces:Finds other surfaces that are identical to the given surface.
  • VerifyUV: Checks if a given UV point lies within the surface boundaries.

By using these methods and properties, you can perform various operations on surfaces in Creo Parametric, such as:

Analysis: Calculating surface area, curvature, and other geometric properties.
Visualization: Controlling the visibility and appearance of surfaces.
Modification: Creating new surfaces or modifying existing ones.
Intersections: Finding intersections between surfaces and other geometric entities.

The IpfcSurface interface provides a powerful toolset for working with surfaces in Creo Parametric, enabling you to automate tasks, optimize designs, and perform complex geometric analysis.

 

 SurfaceTypes

 SurfaceType EpfcSurfaceType EpfcSurfaceType Number
planar surface EpfcSURFACE_PLANE 0
cylindircal surface EpfcSURFACE_CYLINDER 1
conic surface EpfcSURFACE_CONE 2
toroidal surface EpfcSURFACE_TORUS 3
surface created by linearly interpolating between two sets of curves. EpfcSURFACE_RULED 4
surface created by revolving a curve about an axis EpfcSURFACE_REVOLVED 5
surface created by linearly projecting a curve EpfcSURFACE_TABULATED_CYLINDER 6
fillet surface EpfcSURFACE_FILLET 7
Coons path surface EpfcSURFACE_COONS_PATCH 8
spline surface EpfcSURFACE_SPLINE 9
Non-Uniform Rational B-Spline surface EpfcSURFACE_NURBS 10
spline surface created using cylindrical coordinates EpfcSURFACE_CYLINDRICAL_SPLINE 11
Reserved for internal use EpfcSURFACE_SPHERICAL_SPLINE 12
foreign surface EpfcSURFACE_FOREIGN 13
spline surface with 2 derivatives EpfcSURFACE_SPL2DER 14
Use this enumerated value to represent "null" passed to optional properties or method arguments. EpfcSurfaceType_nil 15

 

Code : This method returns the type of surface represented by a SurfaceDescriptor.

Dim ModelItemOwner As IpfcModelItemOwner
Dim ModelItems As IpfcModelItems
Dim Surface As IpfcSurface
Dim SurfaceDescriptor As IpfcSurfaceDescriptor
Dim i As Long

Set ModelItemOwner = Model
Set ModelItems = ModelItemOwner.ListItems(EpfcModelItemType.EpfcITEM_SURFACE)
    
    
    For i = 0 To ModelItems.Count - 1
    
        Set Surface = ModelItems(i)
        Set SurfaceDescriptor = Surface.GetSurfaceDescriptor
        Msgbox SurfaceDescriptor.GetSurfaceType
    
    Next i

 

by korealionkk@gmail.com