Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catia V5 Rename Partnumbers of Bodies by UserForm 1

Status
Not open for further replies.

us01

New member
Oct 29, 2012
14
Hello,

First of All, i'd like to thank the person who helped me last time, due to him, i had improuved my Catia Level (sadly, not in english ..)
So i'finish my code, but it still not working, i mean, it fonction but not fully. Can anyone have a look on my code and tell me my errors ?

This userform helps me to fill the proprietes of Bodies

Thx Everyone
Best Regards


Here is my UserFormInterface
158453Interface.gif


- I named the boxes as "TextBox1", "TextBox2", "TextBox3"


here is my code :
Code:
Sub CATMain()



Set documents1 = CATIA.Documents

Set partDocument1 = documents1.Add("Part")

Set part1 = partDocument1.Part

Set bodies1 = part1.Bodies

Set body1 = bodies1.Add()

part1.Update

Set body2 = bodies1.Add()


part1.Update

Set body3 = bodies1.Add()

part1.Update

Set body4 = bodies1.Add()

part1.Update

Set product1 = partDocument1.GetItem("Part1")


strPath = "H:\VBA\Project\ProjetVBA1.catvba"
strModule = "modMain"
strProcedure = "CATMain"


UserForm1.Show 0

UserForm1.TextBox1.Value


If UserForm1.TextBox1.Text = "" And _
   UserForm1.TextBox2.Text = "" And _
   UserForm1.TextBox3.Text = "" And _
   UserForm1.TextBox4.Text = "" Then
   

      
Else

End If




End Sub
 
Replies continue below

Recommended for you

Hi,

In the picture attached is the body feature properties (right mouse button click on body).

Where do you want to fill those properties ? Did you tried to do it manually first ? Do you want to create some parameters under body or ?

As I remember, Eric recommend you to do a single part1.Update not each time (but this is not the main problem as I can see).



Regards
Fernando

 
I can do it manually, but i want to made a macro, when i click on it, the "userform" will appear, and i should fill the blanks on the macro and thats will made me 5 "bodies" with the name that i have filled in the "textbox".

 
Exactly sir, i just want to rename the new bodies names with a VBA And later if i understand the right working way of macro, i'll add a "line" to catalogue of materials ! But i'm not there ! first of all, i want to rename new bodies
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor