Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: SRY on 2023-06-18, 07:45:58

Title: ChaosScatter by maxscript
Post by: SRY on 2023-06-18, 07:45:58
Code: [Select]
cs = ChaosScatter()
cs.targetNodes = #(poolface) ---one plane
cs.modelNodes = #(ball01,ball02) ---two spheres

Cannot be displayed in max scene,and I can't find them in the Modify panel. But adding it manually is normal,
Am I overlooking something?
Title: Re: ChaosScatter by maxscript
Post by: Frood on 2023-06-18, 10:18:11
Hi, see:

https://forum.corona-renderer.com/index.php?topic=31583.msg189987#msg189987

Good luck


Title: Re: ChaosScatter by maxscript
Post by: SRY on 2023-06-18, 14:00:36
my corona version is 9.0,so it's properties are changed.The following code is not valid:
Code: [Select]
ScatteredObj= sphere radius: 1 position:[0,0,0] --ScatteredObj
b = plane length: 100 width:100 pos: [150,150,0] --distrib object

--SCATTER CREATION
Cscatter isselected: on iconsize: 50 pos: ScatteredObj.pos


--APPENDING
append $.distributionobjects b
append $.distributionobjectsdensity 1.0
append $.scatteredobjects ScatteredObj
append $.scatteredObjectsFrequency 1.0

max zoomext sel -- zooms scatter
now,they are "targetNodes" and "modelNodes", I'd like an expert to explain.
Title: Re: ChaosScatter by maxscript
Post by: Frood on 2023-06-18, 19:11:48
Hi, yes, property names may have changed meanwhile, will check tomorrow.


Good luck


Title: Re: ChaosScatter by maxscript
Post by: Frood on 2023-06-19, 09:02:37
Hi,

yes properties changed as well as the class name. Your script would look like this now (ChaosScatter v2.4):

Code: [Select]
ScatteredObj= sphere radius: 1 position:[0,0,0] --ScatteredObj
b = plane length: 100 width:100 pos: [150,150,0] --distrib objectp

ChaosScatter isselected:on iconsize: 50 pos: ScatteredObj.pos

--APPENDING
append $.targetFactors 1
append $.targetNodes b
append $.modelfrequencies 1
append $.modelNodes ScatteredObj


If you want to see all properties of a class, use 'showclass "<classname>*.*"', so for ChaosScatter: 'showclass "ChaosScatter*.*"'.


Good Luck



Title: Re: ChaosScatter by maxscript
Post by: SRY on 2023-06-19, 10:49:56
I succeeded, but there was one small problem, the scatter is not moved, Is that so ?
Title: Re: ChaosScatter by maxscript
Post by: SRY on 2023-06-19, 11:19:00
I create the scatter with maxscript, It cannot be modified again,Why?
Title: Re: ChaosScatter by maxscript
Post by: Frood on 2023-06-19, 11:40:27
Hi,

I succeeded, but there was one small problem, the scatter is not moved, Is that so ?

it is created where you requested it: at the position of "ScatteredObj", [0,0,0] that is. If you want the ScatterObject/Icon placed at the "pool"/b-plane, then you have to use instead:

Code: [Select]
ChaosScatter isselected:on iconsize: 50 pos: b.pos

I create the scatter with maxscript, It cannot be modified again,Why?

It can for sure, but your script does not save a reference to the ScatterObject for later use. You should store a reference into a variable (MyScatter=ChaosScatter isselected:on iconsize: 50 pos:b.pos) and change the variables properties instead of using the current selection:

Code: [Select]
ScatteredObj= sphere radius: 1 position:[0,0,0] --ScatteredObj
b = plane length: 100 width:100 pos: [150,150,0] --distrib objectp

MyScatter=ChaosScatter isselected:on iconsize: 50 pos: b.pos

--APPENDING
append MyScatter.targetFactors 1
append MyScatter.targetNodes b
append MyScatter.modelfrequencies 1
append MyScatter.modelNodes ScatteredObj

You can now change the properties of 'MyScatter' every time later on. Alternatively you can access the ChaosScatter object by name. These are very basic script topics (https://help.autodesk.com/view/MAXDEV/2023/ENU/?guid=GUID-4C14F474-CD23-4001-93DF-0F0F9A6025C7) though.


Good Luck



Title: Re: ChaosScatter by maxscript
Post by: SRY on 2023-06-19, 14:23:43
I mean I choose it in the max scene,and trying to change some parameters ,doesn't work.Although I also kept the reference, I sometimes fine-tuned it in the scene,no way to change it.
Title: Re: ChaosScatter by maxscript
Post by: Frood on 2023-06-19, 14:43:43
Works for me, no issues changing frequencies or adding/removing items. Can you attach the scene?


Good Luck