×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Macro palette for coloring
2

Macro palette for coloring

Macro palette for coloring

(OP)
I find this macro, but it wont work, i can run it from windows but i it wont work, i cant run it from catia. I m using win7 x64 and CATIA V5 R20.
' COLORS, (c)ema, lm:1.4.2009
'
form="v:\vbscripts\vbs\e3colors.exe"
form="V:\vb6\Visual Studio 2008\Projects\e3colors\e3colors\bin\Debug\e3colors.exe"
'
Language="VBSCRIPT"
Sub CATMain()
' ******************************* test if part is open ********************************
' 'If CATIA is open but no documents are open, exit sub.
' If CATIA.Documents.Count = 0 Then
' 'MsgBox "There is no CATIA Part file open. Open a Part file and run this script again.", ,msgboxtext
' MsgBox "Neni otevreny catpart. Otevri Part a spust program znovu.", ,msgboxtext
' Exit Sub
' End If
' 'If a Product, Drawing, etc is active, exit sub
' If InStr(CATIA.ActiveDocument.Name, ".CATPart") < 1 Then
' 'MsgBox "Active CATIA Document is not a Part. Open a Part file and run this script again.", ,msgboxtext
' MsgBox "Otevreny dokument neni catpart. Otevri Part a spust program znovu.", ,msgboxtext
' Exit Sub
' End If
' ******************************* variables *******************************************
Set cad = CATIA.ActiveDocument
' Set hsf = cad.Part.HybridShapeFactory
' Set spa = cad.GetWorkbench("SPAWorkbench")
' Set prt = cad.Part
Set vis = cad.Selection.VisProperties
' Set spa = cad.GetWorkbench("SPAWorkbench")
' Set viewer = CATIA.ActiveWindow.ActiveViewer
Set objNetwork = CreateObject("Wscript.Network")
msgboxtext="e3colors - barva dobra"
demo=0
' ******************************* set color of selected elements **********************
if(cad.Selection.count=0)then
msgbox "Neni vybran zadny element k obarveni." & vbCrLf & "Vyber plochy a spust makro znovu.", ,msgboxtext
exit sub
end If
rc = CATIA.SystemService.ExecuteProcessus("'"+form+"'")
if Err.Number <> 0 Then
msgbox "Nelze spustit tabulku pro nastaveni barev:" & vbCrLf & form, ,msgboxtext
exit sub
end If
' msgbox rc
if(rc=0)then
exit sub
end if
if(rc>15)then
msgbox "Invalid return code:" & rc, ,msgboxtext
exit sub
end if
if(demo=1)then
msgbox "demo mode running ..." & vbCrLf & "only red color is available as an example" & vbCrLf & "contact x@ema3.com to get licence", ,msgboxtext
vis.SetRealColor 255,0,0,0
cad.Selection.Clear
exit sub
end if
if(rc=1)then
vis.SetRealColor 175,255,175,0
end if
if(rc=2)then
vis.SetRealColor 255,255,175,0
end if
if(rc=3)then
vis.SetRealColor 255,175,175,0
end if
if(rc=4)then
vis.SetRealColor 95,0,0,0
end if
if(rc=5)then
vis.SetRealColor 95,95,175,0
end if
if(rc=6)then
vis.SetRealColor 95,0,95,0
end if
if(rc=7)then
vis.SetRealColor 0,0,255,0
end if
if(rc=8)then
vis.SetRealColor 0,0,95,0
end if
if(rc=9)then
vis.SetRealColor 255,255,0,0
end if
if(rc=10)then
vis.SetRealColor 255,175,0,0
end if
if(rc=11)then
vis.SetRealColor 255,95,0,0
end if
if(rc=12)then
vis.SetRealColor 255,0,255,0
end if
if(rc=13)then
vis.SetRealColor 0,175,175,0
end if
if(rc=14)then
vis.SetRealColor 0,127,255,0
end if
if(rc=15)then
vis.SetRealColor 255,1255,255,0
end if
cad.Selection.Clear
End Sub

RE: Macro palette for coloring

Hi,

As you can see, there are some paths and exe files set in this macro...

form="v:\vbscripts\vbs\e3colors.exe"
form="V:\vb6\Visual Studio 2008\Projects\e3colors\e3colors\bin\Debug\e3colors.exe"

What do you want exactly? If you want to color some features in CATPart in a specific colors, this can be done easy with your own macro.

Regards
Fernando

https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...

RE: Macro palette for coloring

(OP)
i want to make palette of maybe 10 colors, which i frequently use, but i don't know how ...

RE: Macro palette for coloring

i don't want to kill ema3.com business but it seems that if you make your own form with those 15 buttons you could reuse most of this code.

Eric N.
indocti discant et ament meminisse periti

RE: Macro palette for coloring

(OP)
I wish that my palette is always open when I'm working in CATIA, it is always there. The way I used it the following: first select the surface or surfaces and then click the color in the palette, and so on.

thx for helping

RE: Macro palette for coloring

(OP)
oky, thx i ll try

RE: Macro palette for coloring

you can have the graphic properties toolbar open all the time. this will come with a color function where you can add your own personal colors.

Eric N.
indocti discant et ament meminisse periti

RE: Macro palette for coloring

(OP)
Yes u can, indeed, i used tool bar and the graphic properties and i know difference between, so if u can help don't act smart guy.

RE: Macro palette for coloring

(OP)
Of course, i m very thankful to u, every time u answer to my post, but i don't like people who act like smart guys. Every time i have good reasons for my questions, and people on this forum relay help me with 2 3 things.

Thx again.

RE: Macro palette for coloring

star for you ferdo!

noevil

Eric N.
indocti discant et ament meminisse periti

RE: Macro palette for coloring

you post on this forum a sample from another web site. Did you ask the owner of this code about your problem?
How familiar are you with VBA?

Eric N.
indocti discant et ament meminisse periti

RE: Macro palette for coloring

(OP)
i did not, i think that was web page with macros, not forum, and i m very bad with VBA, that s why im posting here, i need few things and i don't have time or will to learn it, so, indeed i m lazy to do it by my own.

RE: Macro palette for coloring

easiest, fastest,and more efficient way would be to contact the developer

Eric N.
indocti discant et ament meminisse periti

RE: Macro palette for coloring

Eric; could you share the address of the CATIA Macro website. Looks like a good source of macros.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources