Can not compare part number and the name of parameter

Can not compare part number and the name of parameter

ngocson8335
Advocate Advocate
473 Views
4 Replies
Message 1 of 5

Can not compare part number and the name of parameter

ngocson8335
Advocate
Advocate

Dear Expert,

 

I can not compare part number of a part and the name of a parameter. Please help me to fix this problem.

 

Here is my code. Thank you.

 

SyntaxEditor Code Snippet

Imports Inventor.CustomPropertyPrecisionEnum
Imports Inventor.CustomPropertyTypeEnum

Dim oPart As PartDocument
oPart = ThisApplication.ActiveDocument

Dim oCompDef As PartComponentDefinition
oCompDef = oPart.ComponentDefinition

oFeatures = oCompDef.Features
Dim oParameter As Parameter
oModelParams = oCompDef.Parameters

i = 1

For Each oParameter In oModelParams

    Dim oPartNum as String = iProperties.Value("Project", "Part Number") & ":" & If (i < 10, "0" + CStr(i), CStr(i)) & ":Height"
    
    If oParameter.Name = oPartNum Then
    
        Select Case sName
    Case oPartNum
            oModelParams.Item(i).ExposedAsProperty = True
            oModelParams.Item(i).CustomPropertyFormat.PropertyType = kTextPropertyType
            oModelParams.Item(i).CustomPropertyFormat.Precision = kThreeDecimalPlacesPrecision
            oModelParams.Item(i).CustomPropertyFormat.ShowLeadingZeros = False
            oModelParams.Item(i).CustomPropertyFormat.ShowTrailingZeros = False
            oModelParams.Item(i).CustomPropertyFormat.ShowUnitsString = True
            oModelParams.Item(i).CustomPropertyFormat.Units = "mm"
    End Select
    End If
    i = i + 1 
Next

 

Ngoc Son
Autodesk User
0 Likes
Accepted solutions (1)
474 Views
4 Replies
Replies (4)
Message 2 of 5

Mark.Lancaster
Consultant
Consultant

@ngocson8335

 

iLogic needs, issues and etc need to be posted in the Inventor Customization forum for best results.

 

I will have the moderator relocate your posting there to better suit your needs.

 

https://forums.autodesk.com/t5/inventor-customization/bd-p/120

Mark Lancaster


  &  Autodesk Services MarketPlace Provider


Autodesk Inventor Certified Professional & not an Autodesk Employee


Likes is much appreciated if the information I have shared is helpful to you and/or others


Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.

0 Likes
Message 3 of 5

ngocson8335
Advocate
Advocate

Thank you, @Mark.Lancaster

Ngoc Son
Autodesk User
0 Likes
Message 4 of 5

mcgyvr
Consultant
Consultant

You are incrementing to the part number such that it never matches the parameter.. 

In your loop print out (messagebox.show) the part number and parameter that you are comparing and you will see the problem right away..



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 5 of 5

Anonymous
Not applicable
Accepted solution

Thank you, I fixed this problem.

 

Ngoc Son

0 Likes