custom iProperties creation

custom iProperties creation

Greatwhitenorth
Collaborator Collaborator
528 Views
3 Replies
Message 1 of 4

custom iProperties creation

Greatwhitenorth
Collaborator
Collaborator

Hi,

 

First off, I know very little about iLogic.  I'm looking for an iLogic Rule that will check the custom iProperties for the following names, and if they don't exist, create them. 

 

MaterialPartNumber

MaterialQty

MaterialUOM

 

I have tried this rule, but it wipes out existing values:

iProperties.Value("Custom", "MaterialPartNumber") = MaterialPartNumber
iProperties.Value("Custom", "MaterialQty") = MaterialQty
iProperties.Value("Custom", "MaterialUOM") = MaterialUOM

 

Could someone here show me how this is done?

 

Thanks in advance.

 

Bob

__________________________________________________________
Product Design & Manufacturing Collection 2023 | Vault Professional 2023
Dell Precision 7670 | Intel i7-12850HX - 2100 Mhz - 64GB
nVIDIA RTX A3000 12GB | Windows 10/64 Pro
0 Likes
Accepted solutions (1)
529 Views
3 Replies
Replies (3)
Message 2 of 4

MechMachineMan
Advisor
Advisor

Have you searched the forums and google?

 

I'm certain there are probably dozens of times this question has been answered on the forums here.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 4

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

Hi Stewart,

 

Please find the following iLogic code to create custom iProperties if it is not existing.

 

    Dim oDoc As PartDocument
    oDoc = ThisApplication.ActiveDocument        

    Dim oPropSets As PropertySet
    oPropSets = oDoc.PropertySets.Item("Inventor User Defined Properties")

    Dim isPartNumber As Boolean = False
    Dim isQty As Boolean = False
    Dim isUOM As Boolean = False

    For Each oProp As Inventor.Property In oPropSets
        If oProp.DisplayName = "MaterialPartNumber" Then
            isPartNumber = True
        ElseIf oProp.DisplayName = "MaterialQty" Then
            isQty = True
        ElseIf oProp.DisplayName = "MaterialUOM" Then
            isUOM = True
        End If
    Next
	
If isPartNumber = False Then iProperties.Value("Custom", "MaterialPartNumber") = "PartNumber" End If If isQty = False Then iProperties.Value("Custom", "MaterialQty") = "Qty" End If If isUOM = False Then iProperties.Value("Custom", "MaterialUOM") = "UOM" End If

Please feel free to contact if there is any doubt.

 

If solves your problem, click on "Accept as solution" / give a "Kudo".

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 4 of 4

Greatwhitenorth
Collaborator
Collaborator
Thanks Chandra! This works perfectly!

Bob
__________________________________________________________
Product Design & Manufacturing Collection 2023 | Vault Professional 2023
Dell Precision 7670 | Intel i7-12850HX - 2100 Mhz - 64GB
nVIDIA RTX A3000 12GB | Windows 10/64 Pro
0 Likes