|
CATIA V5 Programmierung : Makro programmieren um definierte Löcher zu finden
imation1999 am 18.04.2013 um 12:55 Uhr (0)
Hier muß man also zu einem Trick greifen.Zuerst speichert man die einzelnen Elemente der Selection in ein Array:Code:Dim SelElemente() As ObjectReDim SelElemente(Selection1.Count) For i = 1 To Selection1.Count Set SelElemente(i) = Selection1.Item(i)Next iDann löscht man die Selection und weist der Selection einzeln die gespeicherten Objecte zu:Code:For i = 1 To UBound(SelElemente) Selection1.Clear Selection1.Add SelElemente(i).Value ... .. .Next iSo kommst Du in Bohrung rein:Code:Sub CATMain()Dim partDocum ...
|
In das Form CATIA V5 Programmierung wechseln |
|
CATIA V5 Programmierung : Makro programmieren um definierte Löcher zu finden
imation1999 am 18.04.2013 um 18:23 Uhr (0)
Versuch mal mit folgende Code:Code:Sub CATMain()set selection1 = CATIA.ActiveDocument.Selection----nach Bohrungen suchenSelection1.search ".hole,all" ----Selection sichernDim SelElemente() As ObjectReDim SelElemente(Selection1.Count) For i = 1 To Selection1.Count Set SelElemente(i) = Selection1.Item(i)Next dim length1 as lengthdim hole1 dim durchmesser durchmesser = inputbox ("Bitte geben sie den gesuchten Durchmesser an!", "Eingabe gesuchter Durchmesser", durchmesser)----Selection wieder herstel ...
|
In das Form CATIA V5 Programmierung wechseln |
 |
CATIA V5 Programmierung : Winkel messen mit Makro
imation1999 am 24.04.2013 um 08:41 Uhr (0)
Hallo Zusammen,folgende Code messe ich ein Winkel zwischen 2 Linie, aber die Ergebnisse sind nicht immer gleich (siehe Anhang). Es hängt davon ab, in welchem Quadranten des Koordinatensystem (Absolute) sich der Schnittpunkt befindet.Bild1: Schnittpunkt 50; -50; -50 Bild2: Schnittpunkt 50; 50; -50Kennt Ihr eine Lösung dafür?Code:Language="VBSCRIPT"Sub CATMain()Dim partDocument1 As DocumentSet partDocument1 = CATIA.ActiveDocumentDim part1 As PartSet part1 = partDocument1.PartDim UserSelection as SelectionSet ...
|
In das Form CATIA V5 Programmierung wechseln |
|
CATIA V5 Programmierung : Objekt finden, vergleichen und in Tabelle darstellen.
imation1999 am 01.05.2013 um 09:32 Uhr (0)
Ich würde es so machen:Code:Sub CATMain()Set selection1 = CATIA.ActiveDocument.SelectionDim length1 As LengthDim hole1Dim dDim ItDim KeDim C Counter = 1selection1.Search ".hole,all"Set d = CreateObject("Scripting.Dictionary")For i = 1 To selection1.Count Set hole1 = selection1.Item2(i).Value Set length1 = hole1.Diameter If d.Exists(length1.Value) Then C = C + 1 d.Item(length1.Value) = C Else C = 1 d.Add length1.Value, C End If NextIt = d.ItemsKe = d.KeysFor i = 0 To ...
|
In das Form CATIA V5 Programmierung wechseln |
|
CATIA V5 Programmierung : Objekt finden, vergleichen und in Tabelle darstellen.
imation1999 am 01.05.2013 um 10:24 Uhr (0)
Ich würde es so machen (nach empfehlung von Bernd):Code:Sub CATMain()Dim length1 As LengthDim hole1Dim dDim ItDim KeConst CNew = 1 Counter New = 1Dim CAct Counter Actualdim TextSet Selection1 = CATIA.ActiveDocument.SelectionSelection1.Search ".hole,all"Set d = CreateObject("Scripting.Dictionary")For i = 1 To Selection1.Count Set hole1 = Selection1.Item2(i).Value Set length1 = hole1.Diameter If d.Exists(length1.Value) Then CAct = d.Item(length1.Value) CAct = CA ...
|
In das Form CATIA V5 Programmierung wechseln |
|
CATIA V5 Programmierung : Objekt finden, vergleichen und in Tabelle darstellen.
imation1999 am 02.05.2013 um 15:07 Uhr (0)
Zitat:Original erstellt von bgrittmann:Servuskleiner Hinweis zum Makro:ich befürchte (gemäß meinem Test)dass bei diesem Makro die Zählungen von Bohrungen die gemustert wurden, die falsche Anzahl ermittelt wird.GrußBerndHallo Bernd,du hast natürlich Recht.Hast du vielleicht einen Vorschlag, wie man korrigieren kann?EDIT (VBAProject mit Sortierung von Durchmesser):Code:Sub CATMain()Dim length1 As LengthDim hole1Dim dDim ItDim KeConst CNew = 1 Counter New = 1Dim CAct Counter ActualDim Arr()Dim dTemp ...
|
In das Form CATIA V5 Programmierung wechseln |
|
CATIA V5 Programmierung : Beim Fehler die Richtung austauschen
imation1999 am 30.06.2013 um 19:30 Uhr (0)
Hallo Uwe,vielen Dank für Deine Mühe.Könntest Du bitte ein Screeshot über Rule editor und über "tree" auch posten?Ich habe CATIA nur im Büro, aber bin sehr-sehr neugierig.
|
In das Form CATIA V5 Programmierung wechseln |
|
CATIA V5 Programmierung : ImposedVertexRadius - Werte des Radius
imation1999 am 08.07.2013 um 21:43 Uhr (0)
Hallo,in diesem Fall:Variable Fillet ist schon vorhanden (mit mehreren Punkte --- die "Nummer" des Punktes sind unbekannt)ich möchte weitere Punkte hinzufügen, dann die Werte ändern.Zur Zeit läuft alles ganz schön unter VBA, aber ich soll nach dem Ablauf die Punkte kopieren, dann austauschen (Replace). So werden die zugefügte Punkte wieder sichtbar sein.EDIT: Eine von Euch testen?Code:Sub CATMain()Dim partDocument1 As DocumentSet partDocument1 = CATIA.ActiveDocumentDim part1 As PartSet part1 = partDocument ...
|
In das Form CATIA V5 Programmierung wechseln |
|
CATIA V5 Programmierung : ImposedVertexRadius - Werte des Radius
imation1999 am 08.07.2013 um 21:07 Uhr (0)
Hallo Bernd,vielen Dank für Deine Antwort.Der Stützpunkt ist ein ganz normal 3D-Punkt (isoliert).Anbei mein Code:Code:Language="VBSCRIPT"Sub CATMain()Dim partDocument1 As DocumentSet partDocument1 = CATIA.ActiveDocumentDim part1 As PartSet part1 = partDocument1.PartDim hybridBodies1 As HybridBodiesSet hybridBodies1 = part1.HybridBodiesDim hybridBody1 As HybridBodySet hybridBody1 = hybridBodies1.Item("Geometrical Set.1")Dim hybridShapes1 As HybridShapesSet hybridShapes1 = hybridBody1.HybridShapesDim varRadE ...
|
In das Form CATIA V5 Programmierung wechseln |
|
CATIA V5 Programmierung : Macro zur automatischen änderung der Properties bei Maßen
imation1999 am 14.10.2013 um 13:19 Uhr (1)
Hallo,anbei die original Code:http://ww3.cad.de/foren/ubb/Forum137/HTML/003983.shtmlBeispiel 1:Code:Sub CATMain()Dim drawingDocument1 As DrawingDocumentSet drawingDocument1 = CATIA.ActiveDocumentSet oSelection = CATIA.ActiveDocument.SelectionDim InputObjectType(0)InputObjectType(0) = "AnyObject"status = oSelection.SelectElement3(InputObjectType, "Wählen Sie die Bemaßungen aus", True, CATMultiSelTriggWhenUserValidatesSelection, False)If (status "Normal") Then MsgBox "Abbruch" Exit SubElsefor i=1 to o ...
|
In das Form CATIA V5 Programmierung wechseln |
|
CATIA V5 Programmierung : Schleife für Dxf-Umwandlung inkl. Farb- und Layer-änderung
imation1999 am 29.11.2013 um 07:15 Uhr (1)
Hallo,lass mal selection2 weg. Einfach mit selection1 weterarbeiten.Code:......Dim selection1 As SelectionSet selection1 = Document.SelectionFor i = 1 To oFolder.Files.Count Set oFile = oFolder.Files.Item(i) If Right(oFile.Name, 10) = "CATDrawing" Then Name = Left(oFile.Name, Len(oFile.Name) - 11) Datei = Pfad + Name + ".CATDrawing" F = F + 1 Set oActiveDoc = CATIA.Documents.Open(Datei) Set Document = CATIA.ActiveDocumentselection1.Search "Weight=0,2mm,all"Selection1.VisProperties.SetLay ...
|
In das Form CATIA V5 Programmierung wechseln |
|
CATIA V5 Programmierung : Schleife für Dxf-Umwandlung inkl. Farb- und Layer-änderung
imation1999 am 29.11.2013 um 17:00 Uhr (1)
Achso thja, mein Fehler!Versuch mal so...Code:......Dim selection1 As SelectionFor i = 1 To oFolder.Files.Count Set oFile = oFolder.Files.Item(i) If Right(oFile.Name, 10) = "CATDrawing" Then Name = Left(oFile.Name, Len(oFile.Name) - 11) Datei = Pfad + Name + ".CATDrawing" F = F + 1 Set oActiveDoc = CATIA.Documents.Open(Datei) Set Document = CATIA.ActiveDocument Set selection1 = Document.Selectionselection1.Search "Weight=0,2mm,all"Selection1.VisProperties.SetLayer catVisLayerBasic, 1s ...
|
In das Form CATIA V5 Programmierung wechseln |
|
CATIA V5 Programmierung : Schleife für Dxf-Umwandlung inkl. Farb- und Layer-änderung
imation1999 am 29.11.2013 um 18:09 Uhr (1)
Hast Du schon die CATIA-SETTINGS gelöscht?
|
In das Form CATIA V5 Programmierung wechseln |