Page 1 of 2


Posted: Wed Jan 29, 2014 11:14 am
by lubosro
Dear TopSolid Team,

I know, that via PartDefinition|BillOfMaterial page is possible change "index name" manually, but there possibility fullfill BOM index name of elements throught .NET API, maybe in near future???

I'm using v6.13 of TopSolid TypeLibrary and TopSolid.IElement has only one public property, what is BomIndexName, but it is ReadOnly.

Thanks for your opinion.


Posted: Sun Apr 13, 2014 8:08 pm
by Holzknoten
Hi Lubos,

same for me.
I get more and more with VB and TS API to work.
To set element properties is no Problem.

But the index is only readable.
Maybe the official lob-Funktion can help you with this Step.

I will take a look next week.

Posted: Fri Jul 11, 2014 9:35 pm
by topzoli
Hi all

I have got a same problem.
Because it is realy important for us, so i figured a solution for this problem.

You cant change the index, but you able to change the shape's other porpertyes

For an example in supplier property = D-12-2

U need to modify some file export option for this, but its working correctly.

Il do this way:

I use automatic numbering, so i separate the sub assemblies in the assembly(INDEX). Afther i export whit bom export to excel.
i manualy gives the new values(you can write a macro for this) in excel then. I use a code and upload this values to the document.

Ps me if you want and i'll hel you if i can

sory for my english

this is an example:

Dim talalatszamlalo As Integer = 0
Dim talaltnev As String
Dim elemszamlalo As Integer
Dim kism As Long

For kism = 0 To elemszam

elemszamlalo = kism
Label4.Text = talalatszamlalo
elem = osszelemek(elemszamlalo)
elemname = elem
Dim elemtipus As String = elemname.GetTextProperty("$part_type_property")

If elemtipus.StartsWith("R") Or elemtipus.StartsWith("b") Then
For Each cellaertek In cellaertekek
elemname = elem
If elemname.NameOrIdentifier = cellaertek.Value Then
talaltnev = cellaertek.Value
talalatszamlalo = talalatszamlalo + 1
elemname.SetTextProperty("$supplier", cellaertek.Offset(0, 1).Value)
Dim butorelemaz As String = cellaertek.Offset(0, 1).Value
butorelemaz = butorelemaz.Substring(0, 1)
elemname.SetTextProperty("$comment", butorelemaz)
Exit For
ElseIf cellaertek.Value Is Nothing Then
Exit For
End If
Next cellaertek
Label5.Visible = True
Label6.Visible = True
Label6.Text = talaltnev
End If
Next kism

Posted: Mon Jul 14, 2014 6:44 am
by Holzknoten
i found a solutuion with a additional lip/lob file.

I do the most steps like "topzoli" with API.
and for each element i do this steps in lip/lob:
- PushIntegerOnStack(ElementID)
- PushIntegerOnStack(myBOMindex)
- ExecuteMacro(LobPath)

for examples i installed the Modul "TopLip"
so i found for many commands the sorcecode (lip-files) that are easier to understand.

maybe i can make a toturial inside this Forum, when someone is interested.

Posted: Mon Jul 14, 2014 9:36 am
by topzoli
Hi Holzknoten!

I have no time to understand the lip functions yet, but im very intrested.
Any tutorial would help me a lot . :)

Thank you!


[Tutorial] my first lip / lob macro

Posted: Mon Jul 14, 2014 7:52 pm
by Holzknoten
first step is to try to understand the toolsbars, commands and the lip-files.

A easy example: edit reference of Element
This button is inside the attributes-toolbar.

The attributes-toolbar for the Design(Top-Files) is inside

Code: Select all

inside this file you will found this code for the button.

Code: Select all

#Men#Attribute#Reference #0,3041,14 = CATEGORY "#Icn#Category#Attributes" INTERRUPT  $TOPHOME/d/l/setref 10 ;
The last part is the source path of the lob-file. $TOPHOME/d/l/setref = C:/Missler/V6xx/d/l/setref
When you install the Module Top-Lip you will get for many lob-files also the lip-files. The lipfiles are the sourcecode.

Code: Select all

Inside this file you will find at the beginning some notes of original programmer and changenotes inside clips "()".
The following rows shows the definition of needed variables.

Code: Select all

LABEL	label
LABEL	labroot
LABEL	labset
INT	nf
INT	typf
STRING	propname
INT	break
INT	exit
INT	stop
INT	ch
INT	answ

The next rows shows the steps from our button.
There are a lot of "if" "else" and so on.

I know from the lip help file "C:\Missler\V614\local\englishUS\TopLIP.doc"
that the variable type "LABEL" is a mix of current document ID and Element ID (@123).
! = write in variable
? = read from variable

Take a look on these code in row 108

Code: Select all

label? DWcrerootifgen label! labroot!
From the rigth to the left here the translation:
labroot = label = DWcrerootifgen of label-value
I am not 100% sure but these code generated the needed LABEL for the next step.

Now take a look to the main Code. It is only one row.

Code: Select all

labroot? ref? DWsetrefprop
From the rigth to the left here the translation:
DWsetrefprop ref-value for labroot
This code fill in the our wanted ref.value inside a element.

So here a example of my knowlege about this self-studie.

Code: Select all

(define the needed variable for ElemntID as integer)
INT elementid 
(define the mixing Variable for ElementID and DocID as label)
LABEL labroot
(define the needed variable for Refvalue as string) 
STRING refvalue 
(set the Label with ElementID=@57 without @)
57 elementid! 
(set the ref-text inside the variable refvalue)
"text123" refvalue!
(mix and set ElementID with docID. I found this code in a other lip-file)
DDOCWgetcrtid elementid? BuildLabelFromIdentifiers labroot!
(fill in the reftext for our element)
labroot? refvalue? DWsetrefprop
(exit this lip/lop file)
Last steps for the test
1. You need to save the code above inside C:\editref.lip
2. You need an Element with the correct ID @57 or you change the code for this test.
3. You need to convert the lip to a lob file (cmd= C:\Missler\V614\toplip.exe C:\editref.lip) Module TopLip have to be already installed.
4. You need a working test-VB-Projekt with TopSolid API
5. Use this code to activate our lob file

Code: Select all

This is only for trying to understand france-lip-code-language.
This code does only work for one element.
The next learning step comes after first positive experience with this example ;-)

good luck


Posted: Wed Oct 01, 2014 8:42 pm
by topzoli

I think i've got the path now :) Thank you, for this detailed post it's realy useful for me now!

so meanwhile i've figured an other solution for this "index name" problem :D

first: i need to set more set

then i use this code:
Dim TopApp As TopSolid.Application
Dim TopDoc As TopSolid.DocumentDesign
Dim iset As TopSolid.IElements
Dim tset As TopSolid.Set
Dim telem As TopSolid.Element
TopApp = New TopSolid.Application
TopDoc = TopApp.CurrentDocument

iset = TopDoc.Document.Elements

'this is work for the "I" names set
If iset.NameIsUsed("I") Then
tset = iset("I")
For Each shape As TopSolid.Shape In tset.Shapes
telem = shape
Dim tul As String = telem.GetTextProperty("$part_type_property")
If tul = "something if you want to give an index" Then
telem.SetTextProperty("$part_type_property", "I")
End If
End If
------------------------------------------ ------------------
and need to set some predefined index in the top.cfg file

and last i just simply use automatic numbering its simple and fast way i think :)

but the final solution will be the lip! ;)


Posted: Thu Oct 02, 2014 6:26 am
by Holzknoten
thanks for your answer.
I am happy that my little code could help you.

I try to anderstand what you are doing. You SetTextProperty("$part_type_property", "I") of a "set". Do you "sort by" $part_type_property in your *.Bom-File?
I read your code and i have also a question to this term "GetTextProperty("$part_type_property")"
Where do you get the name for this property?
i also try to get the Property "index Key"
i try "$index key" and it does'nt work.

In our company we use our own Code to generate IDs. Some Parts are only decoration and will get no ID.
Sometimes i have to check if an old ID exist(index key).

It would be very usefull to get all terms for the command "GetTextProperty"
  • $part_type_property
  • $Bom_index ?
  • $Index key ?


Posted: Thu Oct 02, 2014 8:09 am
by topzoli
Hi :)

These properties are work both command SetTextProperty - GetTextProperty


These properties are work only GetTextProperty


1. u want to get the supplier
string = TopElt.Element.GetTextProperty("$supplier")
2. you want to set the supplier
TopElt.Element.GetTextProperty("$supplier", "what you want to set")


Posted: Thu Oct 02, 2014 8:16 am
by Holzknoten
Hi topzoli,

thanks a lot.
So i can optimize/speed up my current code.
At the moment i have to generate a Bom to get the special Properties. Thats no more necessary.

Do you have also any expierience with the API-Command "Analyse()"?
I need to get the length and thickness of a shape without using BOM.


Posted: Thu Oct 02, 2014 1:02 pm
by topzoli
I think analyse is only work with volume and area in 3d

double = element.Analyse(TopSolid.TopAnalyse.topVolume)
double = element.Analyse(TopSolid.TopAnalyse.topArea)

where the element is TopSolid.Element

I'hve tried to get somehow the lenght, width, tickness still no sucess. I think there is no option in API :(
Now i working a project
the main function is:

1.) call a .lob macro witch is get the property and pushing in the stack
2.) and the API read that stack "Value = IApplication.GetDoubleFromStack"

Maybe it will be work.


Posted: Thu Oct 02, 2014 1:06 pm
by Holzknoten
Okay analyse is not enough for me.

I give it a try with a lob-file that scan the needed informations.
I will send you my experience.

Thanks a lot.

I try to GetTextProperty("$bom_index_name")
I got only a Error " HRESULT E_FAIL".
Doesn't work:
What did i wrong?
Know this code is working...
Next Problem is, i get only the first $part_type_property of element. See attached pic.
How can i get the other $part_type_propertys of this element?


Posted: Mon Feb 05, 2018 7:31 am
by Holzknoten
is there a solution to get other proberties?



Posted: Fri Nov 02, 2018 2:49 pm
by AlexAS
how can I integrate API in TopSolid V6.17?
I mean, for example: a Lob file can be integrated in TopSolid changing the top.MEN file, adding a line:
"#Men#... #0,292,1 = $TOPHOME/.../...MyLobFilePath
and then I have a new function, perfectly integrated in TopSolid, I just have to press a button and the macro is executed.

Is there something similar also for API? Can I 'create' a button in TopSolid that recalls a VB file?


Posted: Mon Nov 05, 2018 6:41 am
by Holzknoten
I know there are some commands in or file to execute a external .exe file.
Just search to all .lob files for ".exe" with notepad++.
Inside these results choose one .lob file and copy, rename and change inside the name of .exe file.

For the correct icon you have to search the forum. There was a topic about it.