Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

CATIA MACRO QUESTION-How to define partnumber

Status
Not open for further replies.

LILE

Automotive
Joined
Jan 25, 2018
Messages
8
Location
KR
hello guys

I have a question about catia macro code.

How to define partnumber partly?

For example, My partnumber is "engine"

then I define partnumber begine with "en"

So, "eng","end"..etc.. also included

I don't know this macro code.

Thank you.

p.s - I can't english well.


 
i have some problem to understand your question/problem

Eric N.
indocti discant et ament meminisse periti
 
So,

For example, I have 'Product1'

'Product1' is configuration many part.

That partnumber is "eng" , "end", "sus"

If Partnumber start "en", color is red

If Partnumber start "su", color is blue

As a result "eng" and "end" color is red, "sus" color is blue

Thanks
 
ok so what is your code so far and what is the problems?

Eric N.
indocti discant et ament meminisse periti
 
I dont know method all of "En-xxx".

So, I try to test.

This code is activated only "En".

also, This code is wrong.

I want to know method and correct code.

Sub CATMain()

Dim i as Integer
Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument
Dim part1 As Part
Set part1 = partDocument1.Part
Set Bodies1 = Part1.Bodies
Set body1 = Bodies1.Item("PartBody")
Part1.InWorkObject = Body1

Dim visProperties1 As VisProperty
Set visProperties1 = CATIA.ActiveDocument.Selection.VisProperties

Dim r, g, b

r= CLng(0)
g= CLng(0)
b= CLng(0)

For i = 1 To part1.Count

If part1.Item(i).PartNumber = "En" then

part1.PartBodyVisProperty.SetRealColor 255,0,255

End If

End Sub

 
I guess you want to look into the functions INSTR, LEFT... to process your string names.

regards,
LWolf
 
Okay, Guys

I want to Know that code.
Product1
-part1
-PartBody <- I want to change this color.

help me please

Thanks
 
check visporprties in the chm file...

Eric N.
indocti discant et ament meminisse periti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top