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.
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
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 SubRegards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Catia V5 active sketch macro
RE: Catia V5 active sketch macro
RE: Catia V5 active sketch macro
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...
indocti discant et ament meminisse periti