×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • 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!
  • Students Click Here

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

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Catia V5 active sketch macro

Catia V5 active sketch macro

Catia V5 active sketch macro

(OP)
Hello,

Would someone write example script how to draw geometry to active sketch. Is it even possible? I need to draw circle diameter 2mm to point where I click with mouse.

RE: Catia V5 active sketch macro

Hi,

Sample from Dieter Ziethen book

CODE --> CATSscript

' Version:		1.0
' Code:		CATIA CATScript
' Zweck:		Beispiel fur die Erzeugung einer Skizze mit verknĂĽpfter Geometrie
' Vorbereitung:	keine
' Autor:		Dieter Ziethen

CATIA.StatusBar = "CATScript, Version 1.0"

Sub CATMain ()

' Neues CATPart anlegen --------------------------------------------
Dim Bauteil As Part
Dim Dokument As Document
Set Dokument = CATIA.Documents.Add ("Part")
Set Bauteil = Dokument.Part

' Listenobjekt Sketches erzeugen -----------------------------------
Dim Skizzen As Sketches
Set Skizzen = Bauteil.MainBody.Sketches

' Referenzebene erzeugen -------------------------------------------
Dim UrsprungsElemente, Ebene
Set UrsprungsElemente = Bauteil.OriginElements
Set Ebene = UrsprungsElemente.PlaneYZ

' Objekt Sketch erzeugen -------------------------------------------
Dim Skizze As Sketch
Set Skizze = Skizzen.Add (Ebene)

' 2D-Werkzeugkasten erzeugen und Skizze Offnen ---------------------
Dim Wzk As Factory2D
Set Wzk = Skizze.OpenEdition

' Geometrie erzeugen und Linien verknĂĽpfen -------------------------
Dim Punkt (4) As Point2D
Dim Linie (4) As Line2D 
Set Punkt(1) = Wzk.CreatePoint (50, 50)
Set Punkt(2) = Wzk.CreatePoint (-50, 50)
Set Punkt(3) = Wzk.CreatePoint (50, -50)
Set Punkt(4) = Wzk.CreatePoint (-50, -50)
Set Linie(1) = Wzk.CreateLine (-50, 50, 50, 50)
Linie(1).StartPoint = Punkt(2)
Linie(1).EndPoint = Punkt(1)
Set Linie(2) = Wzk.CreateLine (50, 50, 50, -50)
Linie(2).StartPoint = Punkt(1)
Linie(2).EndPoint = Punkt(3)
Set Linie(3) = Wzk.CreateLine (50, -50, -50, -50)
Linie(3).StartPoint = Punkt(3)
Linie(3).EndPoint = Punkt(4)
Set Linie(4) = Wzk.CreateLine (-50, -50, -50, 50)
Linie(4).StartPoint = Punkt(4)
Linie(4).EndPoint = Punkt(2)

' Skizze schlieĂźen und Bauteil aktualisieren -----------------------
Skizze.CloseEdition
Bauteil.Update

End Sub 

Regards
Fernando

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

RE: Catia V5 active sketch macro

(OP)
Ferdo, thank you for example code, but that is not what I looking for. I probably explained unclearly my needs. I need to make new tool to sketcher. Same kind of circle tool, but I need to make only 2mm diameter circles.

RE: Catia V5 active sketch macro

you can create a button and assign a macro to that button.

RE: Catia V5 active sketch macro

Did you try to record that action? (to create 2mm diameter circle in active sketch)

Did you look into v5automation.com? (to create point at cursor selection)

Why don't you post your code here and explain where your problem is?

you might actually get some help...

Eric N.
indocti discant et ament meminisse periti

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

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!


Resources