Reset Properties (Change Colors to Automatics)
Reset Properties (Change Colors to Automatics)
(OP)
Hi, All
I made the script to make elements reset properties.
But I have to click 'OK' button after executing the function.
Here are my youtube link and the script.
Can anybody advice about this without click 'OK' button?
Youtube
I made the script to make elements reset properties.
But I have to click 'OK' button after executing the function.
Here are my youtube link and the script.
Can anybody advice about this without click 'OK' button?
Youtube
CODE --> VBScript
Set ActiveDoc = CATIA.ActiveDocument
Set ActDocSel = ActiveDoc.Selection
CATIA.Startcommand("Reset Properties") 




RE: Reset Properties (Change Colors to Automatics)
indocti discant et ament meminisse periti
RE: Reset Properties (Change Colors to Automatics)
I found this one to do 'disassemble' function with sendkeys.
That is very simple script, but it didn't work.
I think after executing the startcommand then the catia doesn't recognize "Disassemble" window in the 'AppActivate' method.
Could you explain to me why it doesn't work in my script?
CODE --> VBS
Set oWSShell = CreateObject("WScript.Shell") CATIA.Application.StartCommand("Disassemble") oWSShell.AppActivate ("Disassemble") oWSShell.SendKeys "{ENTER}"RE: Reset Properties (Change Colors to Automatics)
Also I needed tools like spy++ to understand the window interaction.
Sorry can't share code...
indocti discant et ament meminisse periti
RE: Reset Properties (Change Colors to Automatics)
http://giphy.com/gifs/glmRyiSI3v5E4
RE: Reset Properties (Change Colors to Automatics)
indocti discant et ament meminisse periti
RE: Reset Properties (Change Colors to Automatics)
...i wonder how Italian engineers behave
RE: Reset Properties (Change Colors to Automatics)
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Reset Properties (Change Colors to Automatics)
Maybe I'm a pussy but whenever I need to do a repetitive task I just do it by hand. All logic goes out the window, just get it done. Make the boss happy, get paid, go home. It ain't much...but it's something!
RE: Reset Properties (Change Colors to Automatics)
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Reset Properties (Change Colors to Automatics)
RE: Reset Properties (Change Colors to Automatics)
I'll find it on the internet.
But before doing, could you tell me just one thing?!
Anyway is it possible in only using vbscript?
RE: Reset Properties (Change Colors to Automatics)
CODE --> CATScript
Language="VBSCRIPT" Sub CATMain() CATIA.DisplayFileAlerts = False Dim Message, Style, Title, Response, MyString Message = ("This macro will change the color of all CATParts to default CATIA color" &_ (chr(13)) &_ ""&(chr(13))&_ " Do you want to continue ?") Style = vbYesNo + vbDefaultButton1 'Define buttons. Button1 means marked by default Title = "Purpose " Response = MsgBox(Message, Style, Title) If Response = vbYes Then ' User chose Yes. MyString = "Yes" Dim productDocument1 As Document Set productDocument1 = CATIA.ActiveDocument Dim selection1 As Selection Set selection1 = productDocument1.Selection selection1.Search "CATPrtSearch.MechanicalFeature,all" Set visPropertySet1 = selection1.VisProperties visPropertySet1.SetRealColor 210,210,255,1 Set visProperties1 = CATIA.ActiveDocument.Selection.VisProperties visProperties1.SetRealOpacity 255,1 selection1.Clear selection1.Search "CATAsmSearch.Part,all" Set visPropertySet1 = selection1.VisProperties visPropertySet1.SetRealColor 210,210,255,1 Set visProperties1 = CATIA.ActiveDocument.Selection.VisProperties visProperties1.SetRealOpacity 255,1 selection1.Clear Dim specsAndGeomWindow1 As Window Set specsAndGeomWindow1 = CATIA.ActiveWindow Dim viewer3D1 As Viewer Set viewer3D1 = specsAndGeomWindow1.ActiveViewer viewer3D1.Reframe Dim viewpoint3D1 As Viewpoint3D Set viewpoint3D1 = viewer3D1.Viewpoint3D End If End SubRegards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Reset Properties (Change Colors to Automatics)
Thanks for your reply.
I'm sorry but I've known your script. Also that is what I already found and tried.
I think this script is good solution.
But there is only one problem in your script.
That is if I directly select a face and change color then execute your script,
only that surface isn't changed.
This means actually your script change to 210,210,255,1 color, not reset color(properties).
If you watch below youtube link, you would understand what I told you.
Please, watch this link.
My Youtube
RE: Reset Properties (Change Colors to Automatics)
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Reset Properties (Change Colors to Automatics)
Usually engineering is a very competitive field and in order to "survive" you have to be the best by working fast and with the best quality. Like Ferdo told, macro are useful for making repetitive jobs easy but also to achieve quality standards not achievable otherwise. I like at work to be relaxed and deliver my work in time and this can be done only with macro's. The are also people that take pride in their work that want to make performance, it's not only about the money at the end of the day.
For sure, it's not worth it to make macro's for tasks that you perform just a few times. Also, no company will invest in creating macro's for just a few people, that it's why in many cases it is very good to know to make macro's yourself.
RE: Reset Properties (Change Colors to Automatics)
I'm sorry, I didn't understand.
Could you explain easier for me?
And did you see my youtube link?
That is what I made in the youtube the difference your script and "reset properties".
RE: Reset Properties (Change Colors to Automatics)
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU