Hello
The objective: to define a text size proportional to a label using a coefficient that will resize the label and the text it contains in the sketch of a part.
I provide you with the code written by an AI, below:
*' Définir la hauteur de base du texte*
*Dim hauteurBase As Double = 5 ' Hauteur initiale en mm*
*Dim hauteurFinale As Double*
* *
*' Calculer la nouvelle hauteur*
*hauteurFinale = hauteurBase * CoeffMultiplicateur*
* *
*' Appliquer au texte dans l'esquisse nommée "Esquisse1"*
*Dim oDoc As PartDocument = ThisApplication.ActiveDocument*
*Dim oCompDef As PartComponentDefinition = oDoc.ComponentDefinition*
*Dim oSketch As Sketch = oCompDef.Sketches.Item("Esquisse1")*
* *
*' Parcourir les objets texte de l'esquisse*
*For Each oTextBox As TextBox In oSketch.TextBoxes*
* oTextBox.Height = hauteurFinale*
*Next*
* *
*' Mettre à jour le modèle*
*InventorVb.DocumentUpdate()*
The problem as soon as I launch the macro, inventor crashes (Inventor 2022 5.2)
I'm a complete ignoramus, would someone correct the code for me, or offer me a code adapted for what I want to get?
Ready in advance
