cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with attribute's value reading when there are regional's characters in attribute name

Creator
Creator

NXOpen(+nx4)

I try to retrieve the values of custom attributes, first read the names of all attributes, then try to get  value for each retrieved name. Any attribute name reading correctly, but if it contains non-english characters, the attempt to read it's value causes exception.

 

Dim AttrInf() As NXObject.AttributeInformation = workPart.GetAttributeTitlesByType(NXObject.AttributeType.Any)
   Dim attr_value As String
   Dim i As Integer
   For i = 0 To AttrInf.Length - 1
       attr_value = ""
       Try
          Select Case AttrInf(i).Type
              Case NXObject.AttributeType.String
                   attr_value = workPart.GetStringAttribute(AttrInf(i).Title)
              Case NXObject.AttributeType.Real
                  attr_value = Convert.ToString(workPart.GetRealAttribute(AttrInf(i).Title))
              Case NXObject.AttributeType.Integer
                  attr_value = Convert.ToString(workPart.GetIntegerAttribute(AttrInf(i).Title))
              Case NXObject.AttributeType.Reference
                    attr_value = Convert.ToString(workPart.GetReferenceAttribute(AttrInf(i).Title))
           End Select
     Catch exs As Exception
     End Try

 

Any ideas how to solve problem will be highly appreciated

6 REPLIES

Re: Problem with attribute's value reading when there are regional's characters in attribute name

Phenom
Phenom

What written language are you working with? Is it supported by the version of NX that you are using?

 

Are your computer's regional settings configured to use the same language?

Re: Problem with attribute's value reading when there are regional's characters in attribute name

Creator
Creator

>What written language are you working with?

Russian

 

>Is it supported by the version of NX that you are using?

NX4 supported russian of course, it's first problem with language

 

>Are your computer's regional settings configured to use the same language?

Yes

Re: Problem with attribute's value reading when there are regional's characters in attribute name

Esteemed Contributor
Esteemed Contributor

Generally NX officially supports only ANSI characters.

Starting with NX 10 UTF-8 is used and foreign characters are officially supported.

 

In the past you could have been lucky to get around any problems with foreign characters, but that was really luck.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Problem with attribute's value reading when there are regional's characters in attribute name

Creator
Creator

Stefan_Pendl, seemed you are right.

Previously I wrote programm on C++ with API function, uf_attr_circle read's values of each attribute properly,  even if it's title contains foreign characters. Now i try to use NXOpen and have failed with this task.

 

Soo, now i wander, if there is any else ability to get attributes value except by it's name (in NXOpen)

 

Re: Problem with attribute's value reading when there are regional's characters in attribute name

Esteemed Contributor
Esteemed Contributor

What encoding is your source code using, UTF-8 or Unicode?

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Problem with attribute's value reading when there are regional's characters in attribute name

Creator
Creator

Stefan_Pendl, i suppose it's utf-8

 

my parts file contains such description

 

<?xml version="1.0" encoding="UTF-8"?>

   <UgAttributes>

       <Attribute owner="part

         title="Р В Р С’Р вЂ”Р В Р С’Р вЂ˜Р С›Р СћР С’Р вЂє"

         value=" Кириллица"

         xsi:type="StringAttributeType"/>

        <Attribute owner="part" title="Р СњР С’Р В§Р С’Р вЂєР В¬Р СњР В˜Р С™"

          value="Кирилин"

          xsi:type="StringAttributeType"/>

 

...and so on

 

PS: and attributes titles look correctly in debagger