• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

change quantity on separate components in the part - ilogic-

  • Thread starter Thread starter Matteo Cappelli dis.CAD
  • Start date Start date

Matteo Cappelli dis.CAD

Guest
Hi.
do you know how to automate with ilogic the setting on the separate quantity part so as to switch from "each" to fx value parameters and unit change?
_foto__209.webpThank you.
 
I don't say I have the solution, but for now only questions. exists a rule for which this rule should only be applied on some components and on others not? what distinguishes the components to be calculated in meters compared to others?
 
Hi.
must replace to qnt 1 piece of the separate table 2d, the length of the transmission chain chosen.
I can currently write on the variable called "lh" within the fx parameters of the part.ipt chain, the formula that determines the length.
But I have to manually open the "document settings" page, click on the tab "different components" and select the "lh" and "m" items (see previous post image)
Thank you._foto__208.webp
 
Vba code slightly adapted, from my tests it seems to work.
myparameter is the name of your parameter, the measuring unit if the lap automatically.
Code:
dim opart as partdocument
opart = thisapplication.activedocument

dim oparameters as parameters
oparameters = opart.componentdefinition.parameters

dim omyparam as parameter
omyparam = oparameters.item("myparameter")
'omyparam.value = 200

call opart.componentdefinition.bomquantity.setbasequantity(kparameterbomquantity, omyparam)
 
I had not noticed the different measuring unit. . .
Code:
    dim opart as partdocument
    opart = thisapplication.activedocument
    
    dim oparameters as parameters
    oparameters = opart.componentdefinition.parameters
    
    dim omyparam as parameter
    omyparam = oparameters.item("myparameter")
    'omyparam.value = 200
    
    call opart.componentdefinition.bomquantity.setbasequantity(kparameterbomquantity, omyparam)
    opart.componentdefinition.bomquantity.baseunits = "m"
 
Hi.
First of all thank you for the time you are dedicating......
I take advantage of it, I attach the file, I launch your command as an ilogic rule but it gives me a mistake.
If you can look at us as soon as you have some time
thanks from now on
 

Attachments

I think the problem was that it is a user parameter and that it serves to "dig" a little more, to me goes (but also before, then crosses fingers;)
Code:
public sub main()
    dim opart as partdocument
    opart = thisapplication.activedocument
        
    dim oparameters as parameters = opart.componentdefinition.parameters
    dim omyuserparam as userparameter = oparameters.userparameters.item("lh")
    
    call opart.componentdefinition.bomquantity.setbasequantity(kparameterbomquantity, omyuserparam)
    opart.componentdefinition.bomquantity.baseunits = "m"

end sub
 
i use 2019.. .

try to remove the <public main()="" sub=""> and <end sub="">;
or here is the vba version from which i adapted that ilogic
</end></public>
Code:
public sub testbom()
    dim opart as partdocument
    set opart = thisapplication.activeeditobject
    
    dim oparameters as parameters
    set oparameters = opart.componentdefinition.parameters
    
    dim omyparam as parameter
    'set omyparam = oparameters.item("myparameter")
    'omyparam.value = 200
    dim ouserparameters as userparameters
    dim omyuserparam as userparameter
    
    set ouserparameters = oparameters.userparameters
    set omyuserparam = ouserparameters.item("lh")
    
    call opart.componentdefinition.bomquantity.setbasequantity(kparameterbomquantity, omyuserparam)
    opart.componentdefinition.bomquantity.baseunits = "m"

end sub
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top