It is better to post whole code as it is not clear how your oCurve object is defined. I am also not sure, why you need to measure the same object oCurve 3 times.
Tesak
https://scripts4all.eu/play-tetris-in-catia-v5-drawing-vba/ - Play Tetris in CATIA V5 drawing
It is not very efficient solution. You should read the whole structure in advance, store it, make your table and just then add/remove items from selection on checkbox click. On fly searching will be really slow for big assemblies and if you perform it on every checkbox click, user experience is...
But what is the logic behind? You add into selection exactly the same items which are already there ... Why? An exercise?
Tesak
https://scripts4all.eu/play-tetris-in-catia-v5-drawing-vba/ - Play Tetris in CATIA V5 drawing
I am not really sure why do you need to add to selection. If you find products you need, you can get them from selection and store them in a collection or dictionary. Later, you can use them as you wish.
I do not see a logic in a code from above. You search selection to get desired items, then...
Your requirements now differs completely? It is really not clear what you are after. Anyway, share the complete code, if you expect to identify error.
Tesak
https://scripts4all.eu/play-tetris-in-catia-v5-drawing-vba/ - Play Tetris in CATIA V5 drawing
You stated at the top, that you select items manually. Why is there a code to add items into selection?
Tesak
https://scripts4all.eu/play-tetris-in-catia-v5-drawing-vba/ - Play Tetris in CATIA V5 drawing
Hi,
In vb scripts it is not allowed to use variable types declaration as all variables are variants. I think you have to launch this macro in VBA,
or maybe try to save it as .catscript where "As" clauses are just being ignored.
Other option is to uncomment or delete all "As" statements in your...
According to Excel reference Const xlWhole = 1, so you make better if you replace True with number 1. If you work from CATIA VBA and you didn't link Excel libraries, then xlWhole constant is unknown which could cause your issues.
Tesak
https://scripts4all.eu/play-tetris-in-catia-v5-drawing-vba/...
Is this code from Catia or Excel? Did you link the right libraries?
Because although it might work I am not sure that this is the right way.
Tesak
https://scripts4all.eu/play-tetris-in-catia-v5-drawing-vba/ - Play Tetris in CATIA V5 drawing
Every text (DrawingText) has a Leaders property. This is a DrawingLeaders collection you look for.
myText.Leaders.Remove(1)
Tesak
https://scripts4all.eu/play-tetris-in-catia-v5-drawing-vba/ - Play Tetris in CATIA V5 drawing
This is pretty easy task, you can use recursion. Please, take some inspiration from here:
https://scripts4all.eu/export-a-product-structure-to-excel-in-vba/
To count the total amount of unique parts & products, you can use a dictionary.
Tesak...
There is, unfortunately, no way to do it directly in CATIA VBA. However, for easier tree reordering you can use external applications.
See a link to one of them below:
https://scripts4all.eu/smartsort/
Tesak
https://scripts4all.eu/play-tetris-in-catia-v5-drawing-vba/ - Play Tetris in CATIA V5...
Hi,
find the product (part) in the tree you would like to work with and call ReferenceProduct.Parent to get the part document.
Tesak
https://scripts4all.eu/play-tetris-in-catia-v5-drawing-vba/ - Play Tetris in CATIA V5 drawing
Yes, it is just the text, you can delete it without breaking the view link.
Tesak
https://scripts4all.eu/play-tetris-in-catia-v5-drawing-vba/ - Play Tetris in CATIA V5 drawing
Hello,
the first you can try is to uncomment On Error Resume Next line, which suppresses all errors, so you have no chance to find out what is happening.
Tesak
https://scripts4all.eu/play-tetris-in-catia-v5-drawing-vba/ - Play Tetris in CATIA V5 drawing
Sorry, but it is really hard to give you advice if we can't test it by ourselves.
Tesak
https://scripts4all.eu/play-tetris-in-catia-v5-drawing-vba/ - Play Tetris in CATIA V5 drawing
Then please upload a sample product as it is really hard to do something meaningful without data.
Tesak
https://scripts4all.eu/play-tetris-in-catia-v5-drawing-vba/ - Play Tetris in CATIA V5 drawing
I do not see any code to extract parameters into excel sheet, as I see it you only extract part number, nothing else.
Tesak
https://scripts4all.eu/play-tetris-in-catia-v5-drawing-vba/ - Play Tetris in CATIA V5 drawing
To get a document from part / product, you can use ReferenceProduct.Parent called on a product object.
Something like:
Dim doc As Document
Set doc = myProd.ReferenceProduct.Parent
Tesak
https://scripts4all.eu/play-tetris-in-catia-v5-drawing-vba/ - Play Tetris in CATIA V5 drawing