Count Parameter
Count Parameter
(OP)
Hi,
I'm trying to find a way to create a parameter that will count the number of like catparts within a catproduct. What I am trying to do is to create an "Attribute Link" within a text box that will display this number of each sub-detail within a weldment.
I haven't had much luck in searching. Any help will be appreciated.
Thanks!!
Dennis
I'm trying to find a way to create a parameter that will count the number of like catparts within a catproduct. What I am trying to do is to create an "Attribute Link" within a text box that will display this number of each sub-detail within a weldment.
I haven't had much luck in searching. Any help will be appreciated.
Thanks!!
Dennis





RE: Count Parameter
RE: Count Parameter
I want the quantity (highlighted) to linked to a parameter. I was thinking it could be an Integer parameter. But I don't know if there is a simple formula that counts the catparts.
Can you put a "Next Loop" as a formula in a parameter?
No idea why the picture isn't sticking with the post.....
RE: Count Parameter
RE: Count Parameter
Also, I don't think a parameter will work the way you're intending it to. Might have to use macro instead... I'm not an expert though, someone chime in and give us some knowledge.
If you choose to go macro, you're going to get the For Next loop from 1 to the total number of parts/products. At each interval, the loop will check your input name to the name of the part/product and act accordingly.
Again, give me some time, I'll see if I can write up some example for you.
Cheers,
RE: Count Parameter
indocti discant et ament meminisse periti
RE: Count Parameter
@djmjr
I don't have a good answer for you at the moment. I'm working on a small piece of code for you but can't figure out one thing...
I'll post anyway as it might lead you in the right direction. Maybe someone else can solve the issue.
CODE --> CATVBS
Option Explicit 'forces variable declaration Sub CATMain() dim partDocument, product, selection, status, filter(0), selCount, name set partDocument = CATIA.ActiveDocument set product = partDocument.Product set selection = partDocument.Selection partName = Inputbox("test1", "test2", "test3") 'input name to be searched selection.Search("Name=partName, all") selCount = selection.Count End SubThe issue here is line "selection.Search("Name=partName, all")". I want to use my input value "partName" as the search field but it doesn't work. I'll see if I can do some more digging around.
Good luck!
RE: Count Parameter
StrToSearch = "Name=" + partName + ", all"
selection.Search(StrToSearch)
?
indocti discant et ament meminisse periti
RE: Count Parameter
I like the macro idea, but in this instance I don't think it will be something I would use since I am generating a BOM with the Bill of Material function, so it isn't like the quantities won't be there for the guys processing material down the line. I was just trying to find a way that was automated that I would show within my captures, at the detail level, this information (qty, size, material type) is shown.
Can a macro be made to do the follwing?
1. Initiates Axonometric View
2. Prompts user to make selection on screen
3. Issues the create text command
4. Prompt user to make selection on screen
5. Fills in text box with the information I'm looking for above.
I'm not asking for one to be developed, I may take a crack at trying to do that myself, once I learn more about this macro and catvbs. I just want to know if its possible?
RE: Count Parameter
indocti discant et ament meminisse periti