Script for Dual dimensions
Script for Dual dimensions
(OP)
Hi,
I have a requirement where in, I want to give dual dimensioning to drawing which is having views already dimensioned with "inch" as primary dimension. I want to give dual dimensioning with "mm" as secondary dimension selecting all dimensions at once.
Can anybody please provide a "VB OR CATScript" which will serve my purpose. Thanks in advance for your help.
Pradeep
I have a requirement where in, I want to give dual dimensioning to drawing which is having views already dimensioned with "inch" as primary dimension. I want to give dual dimensioning with "mm" as secondary dimension selecting all dimensions at once.
Can anybody please provide a "VB OR CATScript" which will serve my purpose. Thanks in advance for your help.
Pradeep





RE: Script for Dual dimensions
Please find code as below.
' Courtesy to Ferdo
Sub CATMain()
Dim oDrwDoc As DrawingDocument
Dim oSheets As DrawingSheets
Dim oSheet As DrawingSheet
Dim oViews As DrawingViews
Dim oView As DrawingView
Dim oDims As DrawingDimensions
Dim MyDimension As DrawingDimension
Dim MyValue As DrawingDimValue
Dim I, J
Dim iIndex
Set oDrwDoc = CATIA.ActiveDocument
Set oSheets = oDrwDoc.Sheets
Set oSheet = oSheets.ActiveSheet
Set oViews = oSheet.Views
For I = 3 To oViews.Count ' scan all views for dimensions except main view and background views
Set oView = oViews.Item(I)
oView.Activate
Set oDims = oView.Dimensions
For J = 1 To oDims.Count
Set MyDimension = oDims.Item(J)
Set MyValue = MyDimension.GetValue
MyDimension.DualValue = catDualBellow ' Dimension dual value display mode.
' MyDimension.DualValue = 1 ' Dimension dual value display mode.
' MyDimension.DualValue = 2 ' Dimension dual value display mode.
' catDualNone or 0 None.
' catDualBellow or 1 Bellow.
' catDualFractional or 2 Fractical.
' catDualSideBySide or 3 Side by side.
' For Main Value
iIndex = 1 ' main value
' If already in inch then don't use
' MyValue.SetFormatName iIndex, "in"
' MyValue.SetFormatPrecision iIndex, "0.00010"
' For Dual Value
iIndex = 2 ' dual value
MyValue.SetFormatName iIndex, "mm"
MyValue.SetFormatPrecision iIndex, "0.00010"
Next 'Dimension Loop End
Next 'Views Loop End
End Sub
Hope this is what you are expecting.
Regards,
Maddy
RE: Script for Dual dimensions
If someone wants to learn something, should post what they tried first, in my opinion is the only way to learn something.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: Script for Dual dimensions
Exactly, without knowing the exact scenario, it'll be difficult to give a proper solution.
RE: Script for Dual dimensions
Thanks for your time.
I checked out the script given by you above, but it is not yielding the desired results.
I am getting an error trying to run the script. Please see attachment.
My requirement is to select all the dimensions in drawing at once & give dual dimension to it. Say if the dimensions given are in "inch" then Script should give the second dimension in "mm" and viceversa.
Thanks
Pradeep
RE: Script for Dual dimensions
Kindly post the error message you are getting.
Regards,
Maddy.
RE: Script for Dual dimensions
open notepad.
Just copy the code and paste it.
Save it as "FileName.CATScript"
Add the folder to libraries.
Goto macro libraries.
Select the macro
Run
Regards,
Maddy
RE: Script for Dual dimensions
Thanks for your time.
As Iam new to CATIA scripting, Iam unable to follow what you are saying.
Please see the attachments for the steps I followed:
In attachments named "Dual 1,2,3,4", I tried to add the code saved as "CATScript" but the file will not be shown in option. Only ".VBA" files are showed.
In second set of attchments "Dual 1.1, 2.2, 3.3", I tried to open the script directly by double, but still no luck.
Please help!!!!
Thanks in advance.
RE: Script for Dual dimensions
Please find the attached new script (file is 28 MB) and hope it is clear this time.
Extract it after downloading.
Goto macro libraries add the new folder (where you have saved the file.) to macro libraries
or simply run the script where you have saved it
(Note: please open only one session of CATIA and drawing file should be opened in it)
or copy the script file to the existing macro library folder
Video is attached for you guidance.
Regards,
Maddy
file is split into 6 parts
RE: Script for Dual dimensions
RE: Script for Dual dimensions
RE: Script for Dual dimensions
RE: Script for Dual dimensions
RE: Script for Dual dimensions
network issue, so i've split the file for faster uploads.
RE: Script for Dual dimensions
Can you please share the link for video, and the files are in ".rar" extension, should I save them in ".catvba" extn??
The files are not giving any extract options!!!
Please help!!
Thanks in advance
Pradeep
RE: Script for Dual dimensions
download all parts to one folder
open any one file out of 6 archive files or right click on one file then extract.
you will see the catscript and video file extracted.
RE: Script for Dual dimensions
without these software's installed you wont find the extract option.
RE: Script for Dual dimensions
I have "7 Zip" installed in my system, still no luck.
Please share link for video, That would be helpful.
Thanks
Pradeep
RE: Script for Dual dimensions
RE: Script for Dual dimensions
RE: Script for Dual dimensions
Thanks alot!!! It works, just awesome.
Results are absolutely wat I was expecting (indeed more than what I was expecting)!!
Cheers!!
Thanks once again!
Pradeep
RE: Script for Dual dimensions
You are welcome,
Do help other people's queries in case if you know something which another person is trying to figure out.
And help each other.
Regards,
Maddy