Truncated Dimensions

Hi folks,

I'm new in journaling.
I'm looking for a journal example for changing color of truncated dimensions (which are added manually) on drawing. It should automatically change truncated dim. color for color green so user can verify if modelling was done properly (in some cases it really helps).

As I said I have poor experience in IT stuff, so at the beginning I would like to recall to the proper parameter of one dimension eg. I have vertical dimension which equals 1 and I just would like to know if this parameter is equal/or not 1.

My "code":
dim count as integer = 0
For Each VerticalDim As Annotations.VerticalDimension In workpart.dimensions
if VerticalDim.Value ...
count += 1
end if
next
Guide.InfoWriteLine("its sth")

I will be very grateful for any help

Follow the link below for a journal that will report and re-color any manual dimensions in the current work part. Manual dimensions are those where the text has been overridden with a new value.

http://nxjournaling.com/comment/1533#comment-1533

Thanks for response.
Do you know how I can subtract (Whole value - displayed value) ?
eg (1.2345-1.20). If this will not be equal 0 I will set color of this dim on green.

A dimension object has a .ComputedSize property that returns a double value representing the "true" length. The code linked to in a previous post shows how to get the dimension text; this will return a string value. The .net framework has some functions to convert a string to a double so that you can use it in mathematical operations. Since you will be dealing with floating point numbers, I suggest taking the absolute value of the difference and comparing the result to a tolerance value that you specify. Simply subtracting the values is not likely to result in a perfect zero value.

If Math.Abs(computed - shown) < your_tolerance then
dimensions match
Else
dimensions do not match
End if

Here are a couple of links about converting string values to double values.
https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/...

https://docs.microsoft.com/en-us/dotnet/api/system.convert.todouble?view...

thanks a lot! I already finished 1st version. It works on simple dimensions wihout additional text eg. REF. I will try to filter it :)

Hi, I finished my journal. The only thing which I have to solve is coloring the reference cylindrical dim which is type "prefix". It works on normal type but not on prefix type. Do you know how can I solve this issue ?

Can you post your code?

I would like to create "if" loop for this case
Line below shows how I create loops for specific cases - reference dimension in this case

if partDimension.ToleranceType = Annotations.ToleranceType.Reference then

Having your code would help a great deal in the debugging process. If you don't want to post your full code, post a simplified version that shows the issue.

Hi, my code below - I pasted only 1 loop because all others are quite similiar. My code also works for angular dims, tolerances and angular tolerances. Overall logic: for each type of dimension I try to compare real value with displayed value. Purpose of that is coloring truncated dimensions.

Dim partDimensions() As Annotations.Dimension
partDimensions = workPart.Dimensions.ToArray
If partDimensions.Length > 0 Then
For Each partDimension As Annotations.Dimension In workpart.Dimensions
If TypeOf partDimension Is Annotations.BaseAngularDimension Then
'skip angular dimensions
Continue For
End If

if partDimension.ToleranceType = Annotations.ToleranceType.None or partDimension.ToleranceType = Annotations.ToleranceType.Reference Then
partDimension.GetDimensionText(text1, text2)
Dim j As Double
For j = text1.GetLowerBound(0) To text1.GetUpperBound(0)
ditemvalue = CDbl(text1(j))
' lw.WriteLine("ditemvalue " & ditemvalue)
Next

manualTextCount += 0
dim truelength As double = partDimension.ComputedSize

If Math.Abs(ditemvalue - truelength) > 0.00005 Then

Dim displayModification1 As DisplayModification
displayModification1 = theSession.DisplayManager.NewDisplayModification()
displayModification1.ApplyToAllFaces = True
displayModification1.ApplyToOwningParts = False
displayModification1.NewColor = 36
Dim objects1(0) As DisplayableObject
objects1(0) = partDimension
displayModification1.Apply(objects1)
displayModification1.Dispose()
End If

Can you post the steps required to create the dimension type that is giving you trouble? Or email an example file to info@nxjournaling.com

I've tried to create a file based on your description, but your code works on the file that I created. There must be something that I'm missing...

Hi,
I replied you via email
Regards

Ok, I see what is happening now. When you change the reference option to include the prefix, the dimension tolerance type becomes "DiameterReference". Your code, in its current form, does not check for this type of dimension.

Hi, thank you for your help. Journal is finished and works very well.
I would like to ask you about source of information when I can find all those classes etc. At the beginning I was using "Getting Started with NXOpen" from Siemens Docs but its just a short overlook for some possibilities. So do you know any more extended source of information?
I was doing this Journal in NX, next Journals I would like to make in Visual Studio. Can you tell me if exist special library for NXOpen in Visual Studio?
Thank you in advance

When working with Visual Studio, there are 4 or 5 NX DLL's that you need to reference in your project. These will give you access to intellisense code completion and the object browser.

If you go to the NX help and browse to the programming tools -> .net reference, there is documentation listing all the NXOpen objects, properties, methods, functions, etc.

https://docs.plm.automation.siemens.com/data_services/resources/nx/1899/...