Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Vault Data Stand workflow for multi-body?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Dai_Tech
299 Views, 3 Replies

Vault Data Stand workflow for multi-body?

Dai_Tech
Enthusiast
Enthusiast

Hello Masters,

 

I have some problems with Vault Data Stand. When making components, Vault is generated the filenames with correct number scheme. Then saving the .iam => Datastand regenerate the filenames (For all documents). Btw, I must click OK for all documents (I don't want to fill anymore properties. I am using vault datastand because it helps to auto select categories and number scheme). See attached video to understand more!!!

 

How to custom that? What is the best workflow for working between Datastand and multibody files?

Thank everyone.

 

0 Likes

Vault Data Stand workflow for multi-body?

Hello Masters,

 

I have some problems with Vault Data Stand. When making components, Vault is generated the filenames with correct number scheme. Then saving the .iam => Datastand regenerate the filenames (For all documents). Btw, I must click OK for all documents (I don't want to fill anymore properties. I am using vault datastand because it helps to auto select categories and number scheme). See attached video to understand more!!!

 

How to custom that? What is the best workflow for working between Datastand and multibody files?

Thank everyone.

 

3 REPLIES 3
Message 2 of 4
Dai_Tech
in reply to: Dai_Tech

Dai_Tech
Enthusiast
Enthusiast

Can somebody help me?

0 Likes

Can somebody help me?

Message 3 of 4
smilinger
in reply to: Dai_Tech

smilinger
Advisor
Advisor
Accepted solution

This is my solution, we just skip all the data standard dialogs for multi-body parts:

 

in Default.ps1:

 

function InitializeWindow
{
    #begin rules applying commonly
    $dsWindow.Title = SetWindowTitle
    InitializeCategory
    InitializeNumSchm
    InitializeBreadCrumb
    InitializeFileNameValidation
    #end rules applying commonly
    $mWindowName = $dsWindow.Name
    switch ($mWindowName)
    {
        'InventorWindow'
        {
            #rules applying for Inventor

            if ($Prop['_CreateMode'].Value)
            {
                # the document is .iam and it is the active document
                if ($Prop['_FileExt'].Value -eq '.IAM' -and $Document -eq $Application.ActiveDocument)
                {
                    SkipMultiBodyParts $Document
                }
            }
        }
        'AutoCADWindow'
        {
            #rules applying for AutoCAD
        }
    }
    $global:expandBreadCrumb = $true
}

# skip multi-body components
function SkipMultiBodyParts($doc)
{
    $occs = $doc.ComponentDefinition.Occurrences
    foreach ($occ in $occs)
    {
        if (IsNewMultiBodyPart $occ)
        {
            SetDocumentProperty $occ.Definition.Document 'User Defined Properties' 'SkipVDS' $true
        }
    }
}

function IsNewMultiBodyPart($occ)
{
    $def = $occ.Definition
    # it is part component and just created
    if ($def.Type -eq 0x5000200 -and $def.Document.FileSaveCounter -eq 0)
    {
        if ($def.Features.Count -eq 1)
        {
            # it is the single only feature of the part
            $feat = $def.Features[1]
            # it is a ReferenceFeature derived from a part and is a solid body
            if ($feat.ReferenceComponent.Type -eq 0x500A700 -and $feat.ReferencedEntity.IsSolid)
            {
                return $true
            }
        }
    }

    return $false
}

function SetDocumentProperty($doc, $propSetName, $propName, $propVal)
{
    $propSet = $doc.PropertySets[$propSetName]
    $prop = $propSet | Where-Object DisplayName -EQ $propName
    if ($prop)
    {
        $prop.Value = $propVal
    }
    else
    {
        $null = $propSet.Add($propVal, $propName)
    }
}

 

 

And in Inventor.cfg:

 

<?xml version="1.0" encoding="utf-8"?>
<Configuration>
    <PathDefinition>{Workspace}\{Prop[Folder].Value}</PathDefinition>
    <FileNameDefinition>{Prop[DocNumber].Value}</FileNameDefinition>
    <PropertyDefinitions>
        <PropertyDefinition PropertyName="DocNumber" DataType="Text" InitialValue="{PathAndFileNameHandler.FileName}" />
        <PropertyDefinition PropertyName="Title" DataType="Text" InitialCopyValue="{UIString[CFG1]} {Prop[Title].Value}" />
        <PropertyDefinition PropertyName="Description" DataType="Text" />
        <PropertyDefinition PropertyName="Comments" DataType="Text" />
        <PropertyDefinition PropertyName="Folder" DataType="Text" InitialValue="." RequiresValue="true"/>
        <PropertyDefinition PropertyName="Original" DataType="Text" InitialCopyValue="{PathAndFileNameHandler.OriginalFullFileName}" />
    </PropertyDefinitions>
    <!--Add INEST to the SupportedFileTypes if you want VDS to handle the .inest files-->
    <SupportedFileTypes>IDW,IAM,IPT,IPN,DWG</SupportedFileTypes>
    <ShowCheckInDialog>True</ShowCheckInDialog>
    <SkipForProperties>SkipVDS</SkipForProperties>
</Configuration>

 

 

This is my solution, we just skip all the data standard dialogs for multi-body parts:

 

in Default.ps1:

 

function InitializeWindow
{
    #begin rules applying commonly
    $dsWindow.Title = SetWindowTitle
    InitializeCategory
    InitializeNumSchm
    InitializeBreadCrumb
    InitializeFileNameValidation
    #end rules applying commonly
    $mWindowName = $dsWindow.Name
    switch ($mWindowName)
    {
        'InventorWindow'
        {
            #rules applying for Inventor

            if ($Prop['_CreateMode'].Value)
            {
                # the document is .iam and it is the active document
                if ($Prop['_FileExt'].Value -eq '.IAM' -and $Document -eq $Application.ActiveDocument)
                {
                    SkipMultiBodyParts $Document
                }
            }
        }
        'AutoCADWindow'
        {
            #rules applying for AutoCAD
        }
    }
    $global:expandBreadCrumb = $true
}

# skip multi-body components
function SkipMultiBodyParts($doc)
{
    $occs = $doc.ComponentDefinition.Occurrences
    foreach ($occ in $occs)
    {
        if (IsNewMultiBodyPart $occ)
        {
            SetDocumentProperty $occ.Definition.Document 'User Defined Properties' 'SkipVDS' $true
        }
    }
}

function IsNewMultiBodyPart($occ)
{
    $def = $occ.Definition
    # it is part component and just created
    if ($def.Type -eq 0x5000200 -and $def.Document.FileSaveCounter -eq 0)
    {
        if ($def.Features.Count -eq 1)
        {
            # it is the single only feature of the part
            $feat = $def.Features[1]
            # it is a ReferenceFeature derived from a part and is a solid body
            if ($feat.ReferenceComponent.Type -eq 0x500A700 -and $feat.ReferencedEntity.IsSolid)
            {
                return $true
            }
        }
    }

    return $false
}

function SetDocumentProperty($doc, $propSetName, $propName, $propVal)
{
    $propSet = $doc.PropertySets[$propSetName]
    $prop = $propSet | Where-Object DisplayName -EQ $propName
    if ($prop)
    {
        $prop.Value = $propVal
    }
    else
    {
        $null = $propSet.Add($propVal, $propName)
    }
}

 

 

And in Inventor.cfg:

 

<?xml version="1.0" encoding="utf-8"?>
<Configuration>
    <PathDefinition>{Workspace}\{Prop[Folder].Value}</PathDefinition>
    <FileNameDefinition>{Prop[DocNumber].Value}</FileNameDefinition>
    <PropertyDefinitions>
        <PropertyDefinition PropertyName="DocNumber" DataType="Text" InitialValue="{PathAndFileNameHandler.FileName}" />
        <PropertyDefinition PropertyName="Title" DataType="Text" InitialCopyValue="{UIString[CFG1]} {Prop[Title].Value}" />
        <PropertyDefinition PropertyName="Description" DataType="Text" />
        <PropertyDefinition PropertyName="Comments" DataType="Text" />
        <PropertyDefinition PropertyName="Folder" DataType="Text" InitialValue="." RequiresValue="true"/>
        <PropertyDefinition PropertyName="Original" DataType="Text" InitialCopyValue="{PathAndFileNameHandler.OriginalFullFileName}" />
    </PropertyDefinitions>
    <!--Add INEST to the SupportedFileTypes if you want VDS to handle the .inest files-->
    <SupportedFileTypes>IDW,IAM,IPT,IPN,DWG</SupportedFileTypes>
    <ShowCheckInDialog>True</ShowCheckInDialog>
    <SkipForProperties>SkipVDS</SkipForProperties>
</Configuration>

 

 

Message 4 of 4
Dai_Tech
in reply to: smilinger

Dai_Tech
Enthusiast
Enthusiast

Thanks sir @smilinger 

That is good ideas. I will try it!!!

 

I'm aslo skipVDS by custom properties. I create a new template with skipVDS custom properties for part file. Therefore, I just edited the code in Inventor.cfg. 

0 Likes

Thanks sir @smilinger 

That is good ideas. I will try it!!!

 

I'm aslo skipVDS by custom properties. I create a new template with skipVDS custom properties for part file. Therefore, I just edited the code in Inventor.cfg. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report