Sorcar icon indicating copy to clipboard operation
Sorcar copied to clipboard

[REQUEST]Create node to save node info in a python variables

Open automataIA opened this issue 5 years ago • 3 comments

A node that take info from model(volume, name, surface, coordinates) and save in a python variable. Then use this variable in a python script and resend the output info to sorcar

automataIA avatar Jun 04 '20 15:06 automataIA

Is creating a separate variable for mesh a necessity? If not, then you can directly access the object's data using obj.data (which returns the mesh). Otherwise, you can get the current mesh info by using BMesh (https://docs.blender.org/api/current/bmesh.html). Before the end of the script, you can push changes to the currently active object (in the context). The "Custom Python Script" node allows you to run a single line code or a script (Text Box input) while providing sockets for "In" and "Out" where the object reference can be passed.

Maybe I can provide you with an alternate approach if you can let me know the use case. Most of the times, you'd want to operate on the geometry directly, without copying its data.

aachman98 avatar Jun 04 '20 15:06 aachman98

Example : im creating a concrete frame( beam, column are solid). I need to create a wall between this beam and column. Then i need all information from this 2 elements(like coordinates and orientation), for resend this variables information in a another sorcar page. Becaouse i need 1 sorcar page for 1 element( wall, beam etc...)

automataIA avatar Jun 04 '20 16:06 automataIA

There a couple of nodes that can help you with transfer of information form one nodetree to another: "Get Variable" and "Set Variable" nodes

Use "Set Variable" node in a nodetree and pass the created object in as value: Screenshot from 2020-06-06 03-22-05

Then use the "Get Variable" node to get that object reference and either access it directly, or get its information like this: Screenshot from 2020-06-06 03-24-18

It will save some performance by not duplicating the mesh to a variable.

aachman98 avatar Jun 05 '20 22:06 aachman98