Create user define parameters in part

Hello,
Is is any example of macro, how to create new user define parameter in part?

If it is possible read parameters and find if parameter exist and if not create it…

Thank you

HI

This difficulty factor is not low!

It is possible to do by script inside zw3d or I need use c++?

Thank you

Perhaps you want to tell you whether you want to create equations or attributes?

Hello,
Only attributes for part

HI

# Author - 金州锅锅
# Date - 2024/5/21
# Version - 29
# Description 
# 演示用户属性添加属性

MACRO main
GLOBAL Str = " "
[vxSend,"$SF=UiPartAt"]
[vxSendEvt,"UiPartAt",1000,2,2]

#遍历选择对象ID
iCnt = 0
	WHILE (iCnt < 5)
	Str<="zw3dforum" + iCnt
	[Print,Str]
	[vxSendEvt,"UiUserProp",1,0,2]
	[vxSendEvt,"UiUserProp",1,0,6,Str]
	[vxSendEvt,"UiUserProp",1,(0,3),6,"test"]
	[vxSend,"~CdPartAtItemHandle(insert)"]
	iCnt=iCnt+1
	ENDWHILE
[vxSendEvt,"UiPartAt",120,2,2]
ENDMACRO

Thank you,

It is way how can I add this macro into my custom toolbar?

Thank you

I hope it helps!

Hello, Thank you very much

Hello,
am I trying to do macro for insert new equation into equation manager, but it only closes the part…

Coud you please help me?

Thank you

MACRO main
[vxSend,"~CdShowEqnMgr"]
[vxSendEvt,“UiEqnMgr”,6,1,6,“name”]
[vxSendEvt,“UiEqnMgr”,6,1,7,“name”]
[vxSendEvt,“UiEqnMgr”,2,1,6,“substrsec(part_name,”_",1)"]
ENDMACRO

@Petrnejedly
HI
:point_down: code :point_down:

# Author - 金州锅锅
# Date - 2024/6/26
# Version - 29
# Description 

MACRO main
[vxSend,"~CdShowEqnMgr"]
[vxSendEvt,"UiEqnMgr",6,1,7,"name"]
[vxSendEvt,"UiEqnMgr",2,1,11]
[vxSendEvt,"UiEqnMgr",2,1,7,"substrsec(part_name,"_",1)"]
[vxSendEvt,"UiEqnMgr",10,1,2]
[vxSendEvt,"UiEqnMgr",-1,0,-1]
ENDMACRO

It works well, thank you

Is it possible to do this by macro?

image

Of course it can be done。

Enter it in the lower right corner

$report

have a look。

Hello,
I use this and it seam that it works… Thank you

[vxSend,"$SF=UiPartAt"]
[vxSendEvt,“UiPartAt”,1000,3,2]
[vxSendEvt,“UiPartAt”,73,1,2,"|Enter"]
[vxSendEvt,“UiPartAt”,72,1,2,"|Enter"]
[vxSendEvt,“UiPartAt”,120,4,2]
[vxSendEvt,“UiPartAt”,120,2,2]

Hello, I have another question, if I run the macro twice, it will overwrite me bbb… How can I solve it?

[vxSend,"$SF=UiPartAt"]
[vxSendEvt,“UiPartAt”,1000,2,2]

[vxSendEvt,“UiUserProp”,1,0,2]
[vxSendEvt,“UiUserProp”,1,0,6,aaa]
[vxSendEvt,“UiUserProp”,1,(0,3),6,“aaa”]
[vxSend,"~CdPartAtItemHandle(insert)"]

[vxSendEvt,“UiUserProp”,1,0,2]
[vxSendEvt,“UiUserProp”,1,0,6,bbb]
[vxSendEvt,“UiUserProp”,1,(0,3),6,“bbb]
[vxSend,”~CdPartAtItemHandle(insert)"]

[vxSendEvt,“UiPartAt”,120,2,2]
first run
image
second run
image

Hello,

Try this

[vxSend,"$SF=UiPartAt"]
[vxSendEvt,“UiPartAt”,1000,2,2]
[vxSendEvt,“UiUserProp”,1,0,2]
[vxSendEvt,“UiUserProp”,1,0,6,“aaa”]
[vxSendEvt,“UiUserProp”,1,(0,3),6,“aaa”]
[vxSendEvt,“UiUserProp”,1,1,2]
[vxSendEvt,“UiUserProp”,1,1,6,“bbb”]
[vxSendEvt,“UiUserProp”,1,(1,3),6,“bbb”]
[vxSendEvt,“UiPartAt”,120,4,2]
[vxSendEvt,“UiPartAt”,120,2,2]

yes, it will work on the assumption that the user parameters are empty, but if one parameter is already there, one line will be overwritten again…

the solution would be if I could find out how many user parameters are inserted or if I could read the name of the user parameters using a macro, but I don’t know how to do it…

@Petrnejedly

This involves algorithms that I can implement, but I don’t want to do useless work.

How can I use the functions vxGetString? Can be used to read text strings from cells? What is the structure?

I have tried this but doesnt work… .

GLOBAL  AAAA = ""
[vxGetString,1,0,2, AAAA]

image

thank you

@Petrnejedly

“C:\Program Files\ZWSOFT\ZW3D 2025\languages\en_US\text\Macro.DOC”