Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips now!
  • 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!

Join Eng-Tips
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

L3munoz (Industrial) (OP)
7 Jan 12 14:58
Hi everybody,

I'm working with CATIA since not a long time, and I'm still a little lost, moreover on CATIA automation...The problem is that I want to split a spline (BottomSpline) using a point (ConnectionPoint(6)), and write it in a macro. Here is my code:

        Dim Split1 As Split
    Dim Supref As Reference
    Set Supref = PtPart.CreateReferenceFromObject(ConnectionPoint(6))
    Set Split1 = PtPart.ShapeFactory.AddNewSplit(Supref, BottomSpline)

        Split1.AddElementToKeep BottomSpline

I'm using this 'guide', but honestly I don't understand it pretty well...
http://catiadoc.free.fr/online/CAAScdBase/CAAScdAutomationHome.htm

I gave as arguments the CuttingElem and the ElemToCut, however, it still gives me an error message, telling me Type Mismatch PtPart.ShapeFactory.AddNewSplit"

What does it mean??

Any help is welcome, thanks in advance,

L3munoz
L3munoz (Industrial) (OP)
7 Jan 12 16:49
I've gone ever to the simplest case, like one line splitted by a point, but it stills gives an error "The method update failed". Actually it fails and the macro works but the splitting operation. Any idea of why does it happen??

Language="VBSCRIPT"

Sub CATMain()
    
    Dim CATIA As Object
    Dim AuxPartDocument As Object

    Set CATIA = CreateObject("CATIA.Application")
    CATIA.Visible = True

    CATIA.Documents.Add("Part")
    CATIA.Documents.Item(1).Activate
    Set AuxPartDocument = CATIA.ActiveDocument
    
    Set PtDoc = AuxPartDocument
    Set PtPart = PtDoc.Part
    Set PtHybridFactory = PtPart.HybridShapeFactory

    Set PtHybridBody = PtPart.HybridBodies
    Set myPtHybridBody = PtHybridBody.Add
    myPtHybridBody.Name = "Train Geometry"

    Set Point1 = PtPart.HybridShapeFactory.AddNewPointCoord(0,0,0)
    Set Point2 = PtPart.HybridShapeFactory.AddNewPointCoord(10,0,0)
    Set Point3 = PtPart.HybridShapeFactory.AddNewPointCoord(5,0,0)
    myPtHybridBody.AppendHybridShape Point1
    myPtHybridBody.AppendHybridShape Point2
    myPtHybridBody.AppendHybridShape Point3

    Set Spline = PtPart.HybridShapeFactory.AddNewSpline
        Spline.SetSplineType 0
        Spline.SetClosing 0

        Spline.AddPoint Point1
        Spline.AddPoint Point2
    myPtHybridBody.AppendHybridShape Spline
    PtPart.InWorkObject = Spline

    Set mySplit = PtPart.HybridShapeFactory.AddNewHybridSplit(Point3,Spline,1)

    myPtHybridBody.AppendHybridShape mySplit

    PtPart.Update
End Sub
L3munoz (Industrial) (OP)
7 Jan 12 18:05
I update my posts. I already fixed the problem. It was absolutely a stupid task. Actually it has to be first the element to be cut, and then the cutting element, so

Set mySplit = PtPart.HybridShapeFactory.AddNewHybridSplit(Point3,Spline,1)

However, I couldn't manage to split the spline with two points. There is a method, AddCuttingElem

http://catiadoc.free.fr/online/CAAScdBase/CAAScdAutomationHome.htm, but it is applied to the same spline and not to the resulting from point3 cutting. The idea should be then to make a second split operation to that first result, but the problem is that there is no part. I mean, if the spline is L and the cut is done at x, the two parts in theory are x and L-x, but with that function I only get x and L...

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!

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close