Document properties, elements, and LIP

All topics about specific development with COM interface, LIP language, API in VB, ...

Moderators: remi77, jacs, Daniel

codycousins
Private
Private
Posts: 2
Joined: Thu Feb 16, 2012 10:07 pm

Document properties, elements, and LIP

Unread post by codycousins »

Recently I've been exploring LIP to automate a few functions in TopSolid. I had some success with exporting a bill of materials to excel thanks to topics on this forum.

Now I'm trying to get the values of document properties as variables in LIP.
For example: File->Properties->General shows a view and a count of elements like $AUTHOR and $CREATION_DATE

Looking at the LIP documentation (out of date as it is) I see functions for GetElementName
and
GetElementDesignation
and with these two I can put a label like (2,1) on the stack and get the name of the elements above ($AUTHOR) or the designation (AUTHOR)

but theres nothing about getting element values or document properties. I tried a few obvious ones like GetElementValue but no luck.

Here is my code so far (very simple, just testing whether I can retrieve the value and print it)

Code: Select all

1 2 BuildLabelFromIdentifiers GetElementName
PrintS
QuitMacro
Has anyone else tried to do this? Suggestions?
Beco
Private First Class
Private First Class
Posts: 10
Joined: Mon Jul 02, 2007 11:50 am
Location: Yambol, Bulgaria
Contact:

Unread post by Beco »

Hi,
I have 2 suggestions:

The Properties of document are available through TopSolid API - IDocument interface . Instead of writing a LIP script you can write a VB script for Excel.

If some parts of script cannot be done with TopSolid API - from API you can call LIP script.
; )
codycousins
Private
Private
Posts: 2
Joined: Thu Feb 16, 2012 10:07 pm

Expanded bill of material

Unread post by codycousins »

(Posting a reply to my own topic instead of a new topic)

I'm trying to understand how TopSolid handles database elements like a bill of material, so that I can use LIP to export a formatted BOM to MS Excel.

Right now I am using this code to export a bill of material to excel

Code: Select all

1 UWdoclock
UWgetactiv "$SET" DDOCWnamtolab 1
labs!
0 UWdoclock
exceltemplatepath? (empty string) 2 (level) template? (template path) path? (output file path) labs? (labels of set) 1 (include title) 1 (excel worksheet) 1 (item)
DTABLEALGPARTSBOMWcreatexp
QuitMacro
output file path and template path strings are specified earlier in the file.

using the above simple macro takes me to this window:
Image
clicking 'expand all' then 'ok' prints an Excel doc with the desired multi-level format, including a line for the assembly. I'd like to eliminate this last step and create the 'expanded' version automatically.

So far I've mostly been beating my head against the wall on this, but have found that TopSolid can create a BOM as a database element (not a table printed in the 3D drawing) and then retrieve its label using this code:

Code: Select all

DDOCWgetcrtid "D_TABLE_ALG_PARTS_BOM" 1 DDOCWeltsbyclass
with the label, the table could be exported to excel or other formats fairly easily. Has anyone else tried to create an expanded, multi-level BOM in the document 'database'? Any pointers would be appreciated.
Holzknoten
Master Corporal
Master Corporal
Posts: 43
Joined: Fri Apr 29, 2011 7:16 am
TopSolid Module: TopSolid'Wood
TopSolid Version: 6.17
Location: Hannover
Contact:

Re: Document properties, elements, and LIP

Unread post by Holzknoten »

hi codycousins,

i am standing at the same point like you.
The full automation export of bill of material to excel stops at the window "level choise".
Here i have to expand manually.

Option 1: You can start a VB-Programm that wait for this window and send.keys({ENTER})

Option 2: Inside the BOM-File is a function called "EXPLORE_MULTI_FLAT_PATTERN"
I try this in my BOM-File

Code: Select all

EXPLORE_MULTI_FLAT_PATTERN{
}
Seems not to work because inside of the BOM Documentation of TopSolid this function is still "in work".
by Holzknoten
Post Reply