Welcome to the COE Discussion Forum! 

 

To participate in the discussion forum, you must be logged in to the website.  If you forget your login information, please contact COE Headquarters at coe@coe.org or (800) 263-2255.

If you are new to the COE Discussion Forum and would like to participate, please register.

 

The COE 2008 Fall Industry Workshops

Automotive
Oct. 15-16
Troy, Michigan

 

Aerospace & Defense
Oct. 27-28
Wichita, Kansas

   

Register Today!

COE DISCUSSION FORUM
Subject: Tools->Options->Parameters and Measure->Units

You are not authorized to post a reply.   
Author Messages
DWalters25

29 Feb 2008 07:27 AM

Hello, I have written a program that will change the LENGTH parameter from INCH to MILLIMETER (or vice-versa). This change happens when a button is selected on my program. The user doesn't have to access the OPTIONS menu each time this parameter needs changing. Even though the change actually takes effect, CATIA doesn't think that anything has happened. When I go to verify the change in TOOLS->OPTIONS->PARAMETERS AND MEASURES->UNITS, I can see the change has taken place and it is not until I hit the 'OK' button on that panel that CATIA recognizes it.

Does anyone know what I can do in my program to provide the same authorization as the 'OK' button does? Is there an "update" that I am missing?

Thanks in advance.

DWalters25

29 Feb 2008 09:51 AM

objSettingControllers = objCATIA.SettingControllers

objUnitsSheetSettingAtt = objSettingControllers.Item(

objUnitsSheetSettingAtt.SetMagnitudeValues(objMagnitude, objUnit, objDecimal, objExpo)

objUnitsSheetSettingAtt.CommitForUnits()

objUnitsSheetSettingAtt.Commit()

objUnitsSheetSettingAtt.SaveRepositoryForUnits()

objUnitsSheetSettingAtt.SaveRepository()

Above is a portion of the code I am using. "objMagnitude" = LENGTH..."objUnit" = Inch or Millimeters..."objDecimal"= 6.000000..."objExpo"= 3.000000.

"CATLieUnitsSheetSettingCtrl")
SKWOK

29 Feb 2008 03:22 PM
Hmm, that is very odd. The only thing I can suggest is try using Product1.Update (or whatever you set your product to) or trying CATIA.StartCommand("UpdateAll").

Steven Kwok
PLM Solutions Consultant
CATIA V5 Instructor
TechniGraphics Inc.
CATIA V5 R16/17/18
CATVBA
VB 6.0
Visual Basic .NET 2003/2005
DWalters25

29 Feb 2008 04:16 PM
Unfotunately, that didn't work. CATIA doesn't recognize the UpdateAll as a valid update. I currently check to see what kind of document is loaded and try to update it. But, that also doesn't seem to do the trick. Any other ideas?
jlatva

06 Mar 2008 12:45 PM

We too would like to see this fixed. We submited this as a PMR and they closed it with the following response. Per HD67829

THIS APAR IS CONSIDERED AS A SUGGESTION
FOR IMPROVEMENT WHICH CANNOT BE
INCORPORATED IN VERSION 5 RELEASE 18 GA
level
PLEASE CONTACT YOUR SUPPORT DEPARTMENT IN
ORDER TO OPEN A REQUIREMENT FORM.
.
.Incident Diagnosis
Parameter's unit is not updated when setting
(allowing choosing the current unit) is modified
through macros.
.
.Development Request Justification
A callback is sent when the setting is modified.
But it is not possible to react for every change
of the setting (performance issue). Another
solution has to be found.
.
.Answer and By-Pass
Restart the session is the best way of doing (to
be sure all setting modification will be taken
into account). For this specific case (change of
unit), after running the macro, go to
Tools/Options to force the setting to be read
again (=>the new unit will be used).

I think we should push to make this work. It would be extremely productive.

Regards,, john Latva

RLEACH

17 Mar 2008 10:51 AM

All,

I found a response in the discussion forum that had a workaround for this problem.

It involved using sendkeys to open tools-options, but did not show any code to do this.

Can anyone share the code for opening tool-options-units tab and then select ok?

 

Roger

DWalters25

17 Mar 2008 11:58 AM

I have used:

     CATIA.StartCommand("Options..."
     CATIA.RefreshDisplay = True

to open the TOOLS->OPTIONS box....but I am having a little problem with the "SendKeys" function. I am trying to find the correct verbage.

DWalters25

18 Mar 2008 10:36 AM

Well, I got it working....I got rid of the "CATIA.RefreshDisplay = True" and added the following lines after committing/saverepository functions:

objCATIA.StartCommand(

AppActivate("CATIA V5")"{TAB 6}")"{ENTER}")

SendKeys.Send(

SendKeys.Send(

Now I got it working like a charm. Thanks for everyone's help.

"Options...")
DWalters25

18 Mar 2008 11:03 AM
One concern has come up is....How do I make sure that when the "OPTIONS..." line has been opened by the StartCommand, how should I make sure that the correct window is displayed for the TAB and ENTER functions to work correctly? I need to make sure that the General->Parameters and Measure->Units window is shown in order for the two SendKeys to work.......anyone have any ideas?
DWalters25

19 Mar 2008 07:46 AM

I believe that I have a working situation, now. From all that has been said and tried...it ends up that only two lines of code needed to be added in order to make it work:

objCATIA.StartCommand("Options...")

objCATIA.ActiveWindow.Close()

Thanks again for everyone's help.

RLEACH

19 Mar 2008 11:47 AM

How do you make sure that the Units tab is active? If it is not, the units don't update.

Roger

DWalters25

19 Mar 2008 12:21 PM
You are right. Appearently, I have had the correct tab displayed so that the code worked. When I choose a different tab to begin with...then the change the LENGTH units with the code....the change is not recognized until I access the UNITS tab and hit the OK.....looks like I have to keep looking at the code and see if I can come up with a solution.
MBERRY

19 Mar 2008 02:16 PM
You really only have 2 options here. You can do this in CAA, or if you want to do it in VB, you have to use windows API's to get at the window handles and manipulate them. Programming using windows API's can be tedious though. If you can live with running your code out of process, there is a tool called AutoIT that I like to use that works really well. It is basically a tool that allows you to program using the windows API's thru a simple scripting language. Just Google "AutoIT" - it is a pretty popular tool.

Mike
DWalters25

19 Mar 2008 02:29 PM
Thanks for the information. I would be interested in CAA. I have some experience with C++, but, not using it with CATIA V5. So far I have only used VB, VBA and VBScript. I'll give the "AutoIT" a try to see more about the window API's.
You are not authorized to post a reply.
Forums > COE Forums > CATIA V5 Programming > Tools->Options->Parameters and Measure->Units



ActiveForums 3.6

    

401 North Michigan Avenue, Chicago, IL 60611-4267 | (312) 321-5153 | (800) COE-CALL (U.S.)