Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Catia V5/V6 Frame and Title Block CreateSpline

AndersonC

Computer
Feb 20, 2025
2
Hello, I have been struggling with trying to create a spline using v6 vb net macro for the frame and title block. I am very new to this and am trying to create a logo. I have been able to create lines and circles but splines/curves have alluded me. I have tried multiple time, this is my latest attempt.

Code:
    ' Initialize CATIA
    Dim CATIA As Object
    Set CATIA = GetObject(, "CATIA.Application")
    
    ' Access the active drawing document
    Dim drawingDoc As DrawingDocument
    Set drawingDoc = CATIA.ActiveDocument
    
    ' Access the drawing sheet
    Dim drawingSheet As DrawingSheet
    Set drawingSheet = drawingDoc.Sheets.Item(1)
    
    ' Access the drawing view
    Dim drawingView As DrawingView
    Set drawingView = drawingSheet.Views.Item(1)
    
    ' Access the Factory2D
    Dim factory2D As Factory2D
    Set factory2D = drawingView.Factory2D
    
    ' Define the points for the spline
    Dim points(2) As Point2D
    Set points(0) = factory2D.CreatePoint(0, 0)
    Set points(1) = factory2D.CreatePoint(10, 10)
    Set points(2) = factory2D.CreatePoint(20, 0)
    
    ' Create a SafeArray to hold the points
    Dim poles As Variant
    poles = CATIA.CreateObject("CATSafeArrayVariant")
    poles.SetArray points
    
    ' Create the spline
    Dim spline As Spline2D
    Set spline = factory2D.CreateSpline(poles)
    spline.Name = "ProjSpline1"
    
    ' Add the spline to the selection
    MyCATIA.ActiveDocument.Selection.Add spline
    
    ' Set visual properties for the spline
    Dim visProperties1 As VisPropertySet
    Set visProperties1 = MyCATIA.ActiveDocument.Selection.VisProperties
    visProperties1.SetRealWidth 2 * inch, 0.25 * inch
    
    ' Update the drawing
    drawingDoc.Update

Any help with this would be greatly appreciated.
 
Replies continue below

Recommended for you

Hi , i did not searched in documentation , but just saying , it is not easily to bring a picture with the logo ?
 
Hi , i did not searched in documentation , but just saying , it is not easily to bring a picture with the logo ?
I did try this, however I kept being met with a "object or property is not supported."
 

Part and Inventory Search

Sponsor