Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Custom User Properties Showing Up Twice in BOM

Status
Not open for further replies.

jzecha

Aerospace
Jan 20, 2016
236
I have this section of code that creates a Part Properties I can export to Excel Via Analyze BOM function.
The issue is that when I Analyze BOM in Catia and Click the Define Formats Button, the "BB Length" property appears 2X on my Hidden Properties list.
When I add both, only one of them has the Length value applied.

Any idea why this is happening or what I am doing wrong?



Code:
            Dim oPartDoc As Document
            Set oPartDoc = CATIA.ActiveDocument

            Dim oPart As CATBaseDispatch
            Set oPart = oPartDoc.GetItem("")
    
            Dim oParameter As Parameters
            Set oParameter = oPart.UserRefProperties
                
                oLength = oLength * 25.4
                Dim length1 As Length
                Set length1 = oParameter.CreateDimension("BB Length ", "LENGTH", 0#)
                length1.Value = oLength
 
Replies continue below

Recommended for you

In this macro, you're creating a new parameter regardless of whether a parameter with the same name exists or not. Better would be to incorporate a logic check. If the parameter exists, then use it, or else create the new parameter.
 
@MarkAF,

I went down that path and still had this issue.
I finally solved it, left all of my code alone, and removed the space between the h at the end of Length and the quotes.
This worked after a ton of problem solving.

Before:
("BB Length ", "LENGTH", 0#)
After:
("BB Length", "LENGTH", 0#)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor