How do I render json in my react component? - json

I have the following json file I am importing into my component:
import { beer, wine, spririts, alcopop } from '../../config/calculator.json';
How can I use the json in my render?
Depending upon what was chosen I would like to use the data for each element, if user clicks beer, then show data for beer. For example, how would I loop through 'sizes' in 'beer'? This is my code so far:
{[drinkType].sizes.map((option, i) =>
<div value={option.id} key={i}>
{option}
</div>
)}
I would like to display the size name, pint, bottle, can etc
I get the error: Cannot read property 'map' of undefined
//calculator.json
{
"beer": {
"name": "Beer or cider",
"sizes": {
"568": {
"name": "Pint",
"size": 0.568,
"id": "pint",
"max": 10,
"icon": "beer_pint"
},
"440": {
"name": "Can",
"size": 0.44,
"id": "can",
"max": 10,
"icon": "beer_can"
},
"330": {
"name": "Bottle",
"size": "0.33",
"id": "bottle",
"max": "10",
"icon": "beer_bottle_330"
},
"275": {
"name": "Small bottle",
"size": 0.275,
"id": "smallBottle",
"max": 10,
"icon": "beer_bottle_275"
}
},
"strength": [4, 4.5, 5, 6, 7, 8, 9]
},
"wine": {
"name": "Wine or champagne",
"sizes": {
"125": {
"name": "Small glass",
"size": 0.125,
"id": "small",
"max": 10,
"icon": "wine_small_glass"
},
"175": {
"name": "Standard glass",
"size": 0.175,
"id": "std",
"max": 10,
"icon": "wine_standard_glass"
},
"250": {
"name": "Large glass",
"size": 0.25,
"id": "large",
"max": 10,
"icon": "wine_large_glass"
},
"1000": {
"name": "Bottle",
"size": 1,
"id": "bottle",
"max": 10,
"icon": "wine_bottle"
}
},
"strength": [9, 10, 10.5, 11, 11.5, 12, 13, 14, 15, 16, 17]
},
"spirits": {
"name": "Spirits or shots",
"sizes": {
"25": {
"name": "Single",
"size": 0.025,
"id": "single",
"max": 10,
"icon": "spirit_single"
},
"35": {
"name": "Large single",
"size": 0.035,
"id": "lgSingle",
"max": 10,
"icon": "spirit_large_single"
},
"50": {
"name": "Double",
"size": 0.05,
"id": "double",
"max": 10,
"icon": "spirit_double"
},
"70": {
"name": "Large double",
"size": 0.07,
"id": "lgDouble",
"max": 10,
"icon": "spirit_large_double"
},
"700": {
"name": "Bottle",
"size": 0.7,
"id": "bottle700",
"max": 3,
"icon": "spirit_bottles"
},
"1000": {
"name": "Bottle",
"size": 1,
"id": "bottle",
"max": 3,
"icon": "spirit_bottles"
}
},
"strength": [37, 40]
},
"alcopop": {
"name": "Alcopop",
"sizes": {
"275": {
"name": "Small bottle",
"size": 0.275,
"id": "small",
"max": 10,
"icon": "alcopops_small_bottle"
},
"330": {
"name": "Standard bottle",
"size": 0.33,
"id": "std",
"max": 10,
"icon": "alcopops_standard_bottle"
},
"750": {
"name": "Large bottle",
"size": 0.75,
"id": "large",
"max": 10,
"icon": "alcopops_large_bottle"
}
},
"strength": [5, 5.5]
}
}

.map does not work on objects like that,
map() is only for Arrays
Instead you can store the keys in array and use them, like,
import jsonData from '../../config/calculator';
...
//in constructor or any function
let sizes;
sizes={};
for(let i of Object.keys(jsonData)){
if(!sizes[i][0])sizes[i] = [];
for(let j of Object.keys(i.sizes)){
sizes[i].push(jsonData[i].sizes[j])
}
}
this.setState({
sizesArray:sizes
})
Now you can use this.state.sizesArray.map to iterate over sizes, like,
{this.state.sizes[drinkType].map((option, i) =>
<div value={option.id} key={i}>
{option}
</div>
)}

First, import your json inside the component:
import jsonData from '../../config/calculator'; //specify the appropriate location of the json file
Then you can access the "data" in your component in various ways. One way could be:
constructor() {
this.state = {
data: []
}
}
componentDidMount(){
this.setState({data: jsonData});
}
And accordingly, you can use this data(this.state.data).

Related

Flutter dynamic data from api to make Widgets

In my case the json will be different every time and i have to make widget like "inputtype": "dropdown", "inputtype": "radiobutton" but if i craete model it don't go as i wants it to.
{
"fields": [
{
"id": 31,
"name": "make",
"isrequired": "required",
"valuetype": "text",
"priority": 1,
"inputtype": "dropdown",
"max_min": [],
"rangeable": "false",
"choices": [
{
"id": 46,
"name": "Samsung",
"categoryextrafield_id": 31,
"created_at": "2021-12-29T01:30:47.000000Z",
"updated_at": "2021-12-29T01:30:47.000000Z",
"priority": 10
},
{
"id": 47,
"name": "Dell",
"categoryextrafield_id": 31,
"created_at": "2021-12-29T01:30:52.000000Z",
"updated_at": "2021-12-29T01:30:52.000000Z",
"priority": 20
},
{
"id": 48,
"name": "IBM",
"categoryextrafield_id": 31,
"created_at": "2021-12-29T01:31:09.000000Z",
"updated_at": "2021-12-29T01:31:09.000000Z",
"priority": 30
},
{
"id": 49,
"name": "Acer",
"categoryextrafield_id": 31,
"created_at": "2021-12-29T01:31:24.000000Z",
"updated_at": "2021-12-29T01:31:24.000000Z",
"priority": 40
}
],
"available": []
},
{
"id": 32,
"name": "model",
"isrequired": "required",
"valuetype": "text",
"priority": 2,
"inputtype": "textfield",
"max_min": [],
"rangeable": "false",
"choices": [],
"available": [
{
"model": "a51"
},
{
"model": "y9s"
},
{
"model": "a31"
},
{
"model": "yS10"
},
{
"model": "Y10S"
},
{
"model": "A551"
},
{
"model": "node8"
},
{
"model": "s9"
},
{
"model": null
},
{
"model": "2021"
},
{
"model": "2020"
},
{
"model": "2010"
},
{
"model": "Civic"
},
{
"model": "2019"
},
{
"model": "Daewooy9"
},
{
"model": "corei5"
},
{
"model": "corei9"
},
{
"model": "corei3"
},
{
"model": "corei11"
}
]
},
{
"id": 29,
"name": "features",
"isrequired": "required",
"valuetype": "text",
"priority": 3,
"inputtype": "checkbox",
"max_min": [],
"rangeable": "false",
"choices": [
{
"id": 41,
"name": "Bluetooth",
"categoryextrafield_id": 29,
"created_at": "2021-12-29T01:19:00.000000Z",
"updated_at": "2021-12-29T01:19:00.000000Z",
"priority": 1
},
{
"id": 42,
"name": "Fingerprint",
"categoryextrafield_id": 29,
"created_at": "2021-12-29T01:19:10.000000Z",
"updated_at": "2021-12-29T01:19:10.000000Z",
"priority": 10
},
{
"id": 43,
"name": "LedDisplay",
"categoryextrafield_id": 29,
"created_at": "2021-12-29T01:19:35.000000Z",
"updated_at": "2021-12-29T01:19:35.000000Z",
"priority": 15
}
],
"available": []
},
{
"id": 30,
"name": "condition",
"isrequired": "required",
"valuetype": "text",
"priority": 4,
"inputtype": "radiobutton",
"max_min": [],
"rangeable": "false",
"choices": [
{
"id": 44,
"name": "Used",
"categoryextrafield_id": 30,
"created_at": "2021-12-29T01:20:31.000000Z",
"updated_at": "2021-12-29T01:20:31.000000Z",
"priority": 10
},
{
"id": 45,
"name": "New",
"categoryextrafield_id": 30,
"created_at": "2021-12-29T01:20:38.000000Z",
"updated_at": "2021-12-29T01:20:38.000000Z",
"priority": 20
}
],
"available": []
}
]
}

json jq request format

I need help to extract data from this JSON file using jq.
The app flv then verify the streamname mystrame is active and extract meta.video.height
I did try lot of queries without success and my jq knowledge is poor.
{
"port": 1935,
"server_index": 0,
"applications": [{
"name": "hls",
"live": {
"streams": [{
"name": "donbosco",
"time": 2380739,
"bw_in": 2112440,
"bytes_in": 541618713,
"bw_out": 0,
"bytes_out": 0,
"bw_audio": 35544,
"bw_video": 2076888,
"clients": [{
"id": 453,
"address": "127.0.0.1",
"time": 2380959,
"flashver": "FMLE/3.0 (compatible; Lavf57.83.100)",
"dropped": 0,
"avsync": 28,
"timestamp": 2382635,
"publishing": true,
"active": true
}],
"records": [],
"meta": {
"video": {
"width": 1168,
"height": 720,
"frame_rate": 25,
"codec": "H264",
"profile": "High",
"level": 3.1
},
"audio": {
"codec": "AAC",
"profile": "LC",
"channels": 2,
"sample_rate": 16000
}
},
"nclients": 1,
"publishing": true,
"active": true
}],
"nclients": 1
},
"recorders": {
"count": 0,
"lists": []
}
},
{
"name": "flv",
"live": {
"streams": [{
"name": "mystream",
"time": 2382811,
"bw_in": 2059096,
"bytes_in": 541841549,
"bw_out": 2059096,
"bytes_out": 543351459,
"bw_audio": 35472,
"bw_video": 2023624,
"clients": [{
"id": 452,
"address": "127.0.0.1",
"time": 2382727,
"flashver": "LNX 9,0,124,2",
"dropped": 0,
"avsync": -12,
"timestamp": 2384520,
"publishing": false,
"active": true
},
{
"id": 451,
"address": "127.0.0.1",
"time": 2383031,
"flashver": "FMLE/3.0 (compatible; Lavf58.74.100)",
"dropped": 0,
"avsync": -12,
"timestamp": 2384520,
"publishing": true,
"active": true
}
],
"records": [],
"meta": {
"video": {
"width": 1168,
"height": 720,
"frame_rate": 25,
"codec": "H264",
"profile": "High",
"level": 3.1
},
"audio": {
"codec": "AAC",
"profile": "LC",
"channels": 2,
"sample_rate": 16000
}
},
"nclients": 2,
"publishing": true,
"active": true
}],
"nclients": 2
},
"recorders": {
"count": 0,
"lists": []
}
}
]
}
Are you asking for help with the command-line JSON processor jq or the JavaScript library jQuery? They are not the same. For jq, try
jq '
.applications
| map(select(.name == "flv"))[].live.streams
| map(select(.name == "mystream" and .active))[].meta.video.height
'
720
Demo

Problem getting Image URL with Strapi / Nuxt

I am trying to get the image URL from a JSON which I get from a call to my strapi content. It is for an events website. Here is the code. When I console.log the image url, i get 'undefined'. However, all other properties of event show up no problem.
created() {
axios.get('http://localhost:1338/events').then(res => {
this.events = res.data.sort((a, b) => b.date < a.date ? 1: -1);
console.log(this.events[0].image.url)
})
.catch(err => console.log(err))
}
Console: undefined
Here is the JSON:
{
"id": 1,
"title": "Aphex Twin Live Set",
"description": "Risus viverra adipiscing at in tellus integer feugiat scelerisque varius.",
"date": "2020-12-23T16:00:00.000Z",
"price": 10,
"published_at": "2020-12-19T17:25:44.340Z",
"created_at": "2020-12-19T17:25:41.833Z",
"updated_at": "2020-12-19T21:42:15.696Z",
"image": [
{
"id": 1,
"name": "aphex.jpeg",
"alternativeText": "",
"caption": "",
"width": 1200,
"height": 630,
"formats": {
"thumbnail": {
"name": "thumbnail_aphex.jpeg",
"hash": "thumbnail_aphex_11b34d4058",
"ext": ".jpeg",
"mime": "image/jpeg",
"width": 245,
"height": 129,
"size": 4.12,
"path": null,
"url": "/uploads/thumbnail_aphex_11b34d4058.jpeg"
},
"large": {
"name": "large_aphex.jpeg",
"hash": "large_aphex_11b34d4058",
"ext": ".jpeg",
"mime": "image/jpeg",
"width": 1000,
"height": 525,
"size": 28.49,
"path": null,
"url": "/uploads/large_aphex_11b34d4058.jpeg"
},
"medium": {
"name": "medium_aphex.jpeg",
"hash": "medium_aphex_11b34d4058",
"ext": ".jpeg",
"mime": "image/jpeg",
"width": 750,
"height": 394,
"size": 18.95,
"path": null,
"url": "/uploads/medium_aphex_11b34d4058.jpeg"
},
"small": {
"name": "small_aphex.jpeg",
"hash": "small_aphex_11b34d4058",
"ext": ".jpeg",
"mime": "image/jpeg",
"width": 500,
"height": 263,
"size": 10.67,
"path": null,
"url": "/uploads/small_aphex_11b34d4058.jpeg"
}
},
"hash": "aphex_11b34d4058",
"ext": ".jpeg",
"mime": "image/jpeg",
"size": 37.07,
"url": "/uploads/aphex_11b34d4058.jpeg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"created_at": "2020-12-19T17:25:35.172Z",
"updated_at": "2020-12-19T17:25:35.183Z"
}
],
"categories": [
{
"id": 1,
"name": "Music",
"published_at": "2020-12-19T21:18:16.946Z",
"created_at": "2020-12-19T21:18:13.393Z",
"updated_at": "2020-12-19T21:18:16.961Z"
}
],
"artists": [
{
"id": 1,
"name": "Aphex Twin",
"bio": "Richard James is a pretty old guy by now but he was banging in the techno/ambient electronic scene in the late 80s and 90s. He's from Cornwall so must've been pretty bored on most days, which lead him to hack at computers and electronic sound generators. The rest is history.",
"published_at": "2020-12-19T21:42:33.225Z",
"created_at": "2020-12-19T21:42:03.445Z",
"updated_at": "2020-12-19T21:42:33.251Z",
"artist_image": []
}
]
}
Again -- all fields show if I console.log, but not image.url
Got it -- the image field is an array because I allowed multiple media on Strapi. Had to do event.image[0].url

How to match a json value with the jq command?

I have the following json data:
{
"item_i7bfe8f00": {
"id": "i7bfe8f00",
"tag": "item",
"fields": {
"img": "https://example.com",
"quantity": {
"qtyPrefix": "Kuantitas",
"min": 1,
"autoOptions": false,
"quantity": 5,
"max": 5,
"editable": true,
"showIncrDecr": true,
"showOptions": false,
"step": 1
},
"sellerName": "ALL ITEM STORE",
"title": "Xiaomi Redmi 4A Softcase Black",
"stockTip": {},
"valid": true,
"itemId": "143800088",
"operations": [
"wishlist",
"delete"
],
"sellerId": "100124080",
"price": {
"price": 3500,
"currentPrice": "Rp3.500",
"originPrice": "Rp15.000",
"promotionRatio": "-77%"
},
"restriction": false,
"isGift": false,
"sku": {
"skuText": "Softcase, Hitam",
"productVariant": "SO908ELAAVYY4AANID-72544754",
"brandId": "17818",
"skuId": "157608391"
},
"itemUrl": "https://example.com",
"cartItemId": 2080280320
},
"type": "biz"
},
"item_i7c09dcce": {
"id": "i7c09dcce",
"tag": "item",
"fields": {
"img": "https://example.com",
"quantity": {
"qtyPrefix": "Kuantitas",
"min": 1,
"autoOptions": false,
"quantity": 1,
"max": 5,
"editable": true,
"showIncrDecr": true,
"showOptions": false,
"step": 1
},
"sellerName": "PT. Ecart Services Indonesia",
"title": "Black",
"stockTip": {},
"valid": true,
"itemId": "345695828",
"operations": [
"wishlist",
"delete"
],
"sellerId": "100161156",
"price": {
"price": 2499000,
"currentPrice": "Rp2.499.000"
},
"restriction": false,
"isGift": false,
"sku": {
"skuText": "Hitam",
"productVariant": "345695828_ID-359330058",
"brandId": "21734",
"skuId": "359330058"
},
"itemUrl": "https://example.com",
"cartItemId": 2081021134
},
"type": "biz"
}
}
and I want to show the object that only has "cartItemId": 2081021134 so the end result should look like this:
{
"item_i7c09dcce": {
"id": "i7c09dcce",
"tag": "item",
"fields": {
"img": "https://example.com",
"quantity": {
"qtyPrefix": "Kuantitas",
"min": 1,
"autoOptions": false,
"quantity": 1,
"max": 5,
"editable": true,
"showIncrDecr": true,
"showOptions": false,
"step": 1
},
"sellerName": "PT. Ecart Services Indonesia",
"title": "Black",
"stockTip": {},
"valid": true,
"itemId": "345695828",
"operations": [
"wishlist",
"delete"
],
"sellerId": "100161156",
"price": {
"price": 2499000,
"currentPrice": "Rp2.499.000"
},
"restriction": false,
"isGift": false,
"sku": {
"skuText": "Hitam",
"productVariant": "345695828_ID-359330058",
"brandId": "21734",
"skuId": "359330058"
},
"itemUrl": "https://example.com",
"cartItemId": 2081021134
},
"type": "biz"
}
}
This is what I have tried so far :
jq 'select(.cartItemId==2081021134)' input.json
but it returns nothing, how should I fix it ?
You have to go digging a little deeper. Feed the values of the object to select, and check .fields.cartItemId, not just .cartItemId.
jq '.[] | select(.fields.cartItemId == 2081021134)' input.json
This produces the desired output. Using with_entries makes it easy to retain the keys.
with_entries( if .value | has("fields")
then select(.value.fields.cartItemId == 2081021134)
else . end)

Three.js clone creates a copy of mesh information of the volume and its childs

I need to create a 3D model of a complex geometry (nuclear physics particle detectors) using ThreeJS.
In one example I have about 100.000 geometries and 4.5 Million logical volumes.
I import the geometry using JSON format but then I'm facing two problems.
the JSON file is huge (3.5 Gb)
obviously the file cannot be imported using the editor available at http://threejs.org/editor/. Probably because of memory problems.
For example, in the JSON file I'm using a new UUID when I position a volume. I'm woundering if I could use the UID of the volume that I have already positioned once whithout redefining all of its childs and this should be enough to reposition the full tree.
Just for clarification I create a small example of JSON file where "Box 1" contains others volumes and then I cloned "Box 1" and repositioned it inside "Container 1". You can see that that all childs of "Box 1" have also been copied (indeed only information about mesh.
{
"metadata": {
"version": 4.3,
"type": "Object",
"generator": "ObjectExporter"
},
"geometries": [
{
"uuid": "0F1A7764-83AC-41AE-BB49-AE74A475CF80",
"type": "BoxGeometry",
"width": 500,
"height": 500,
"depth": 500,
"widthSegments": 1,
"heightSegments": 1,
"depthSegments": 1
},
{
"uuid": "E69365CA-206A-4286-BB0D-940A804B7DEB",
"type": "TorusGeometry",
"radius": 100,
"tube": 40,
"radialSegments": 16,
"tubularSegments": 64,
"arc": 6.28
},
{
"uuid": "B2B3E2FD-17C5-42B3-8732-0918F4196199",
"type": "SphereGeometry",
"radius": 75,
"widthSegments": 32,
"heightSegments": 16,
"phiStart": 0,
"phiLength": 6.283185307179586,
"thetaStart": 0,
"thetaLength": 3.141592653589793
},
{
"uuid": "CCB3F065-632D-4AD4-AB16-6DC65D3F9163",
"type": "CylinderGeometry",
"radiusTop": 20,
"radiusBottom": 20,
"height": 100,
"radialSegments": 32,
"heightSegments": 1,
"openEnded": false
},
{
"uuid": "D3905F27-8D63-447B-A4D2-D4901FAB00E2",
"type": "BoxGeometry",
"width": 100,
"height": 100,
"depth": 100,
"widthSegments": 1,
"heightSegments": 1,
"depthSegments": 1
},
{
"uuid": "EE1DB156-C18F-41B1-B1B5-E4B2619F6FC2",
"type": "BoxGeometry",
"width": 100,
"height": 100,
"depth": 100,
"widthSegments": 1,
"heightSegments": 1,
"depthSegments": 1
}],
"materials": [
{
"uuid": "6B15E58A-F80D-4BC4-A1DE-185A846B6BBD",
"type": "MeshPhongMaterial",
"color": 16777215,
"emissive": 0,
"specular": 1118481,
"shininess": 30,
"side": 2,
"opacity": 0.5,
"transparent": true
},
{
"uuid": "BD2913CC-3A1F-45A7-8498-F90988426445",
"type": "MeshLambertMaterial",
"color": 16777215,
"emissive": 16723858
},
{
"uuid": "135C8BD4-895B-42C8-A72D-3FB356248D7A",
"type": "MeshLambertMaterial",
"color": 16777215,
"emissive": 63744
},
{
"uuid": "033485A5-CADB-4240-B01B-8EF94148626C",
"type": "MeshLambertMaterial",
"color": 16777215,
"emissive": 9605120
},
{
"uuid": "DD696C09-0225-446A-A040-CA9917C49D6A",
"type": "MeshLambertMaterial",
"color": 16777215,
"emissive": 275455
},
{
"uuid": "7E04EF43-1516-433E-ABD1-42E303AA0F19",
"type": "MeshLambertMaterial",
"color": 16777215,
"emissive": 9705297
}],
"object": {
"uuid": "6BE54385-5498-42D2-B3D4-2377AE039F70",
"type": "Scene",
"name": "Scene",
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],
"children": [
{
"uuid": "C900FDBD-6DC9-41FD-8536-65AAEFD4CC13",
"type": "Mesh",
"name": "Box 1",
"geometry": "0F1A7764-83AC-41AE-BB49-AE74A475CF80",
"material": "6B15E58A-F80D-4BC4-A1DE-185A846B6BBD",
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,-44.368385314941406,1],
"children": [
{
"uuid": "E04152A2-AA7D-4D36-AAF7-63CF6A109D42",
"type": "Mesh",
"name": "Torus 2",
"geometry": "E69365CA-206A-4286-BB0D-940A804B7DEB",
"material": "BD2913CC-3A1F-45A7-8498-F90988426445",
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,16.59000015258789,0,108,1]
},
{
"uuid": "37414A51-B50E-4944-AFC5-A15EA7B0AF58",
"type": "Mesh",
"name": "Sphere 3",
"geometry": "B2B3E2FD-17C5-42B3-8732-0918F4196199",
"material": "135C8BD4-895B-42C8-A72D-3FB356248D7A",
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,-169.27000427246094,1]
},
{
"uuid": "6B0D91CC-C760-4311-A2BF-7A83C2E86306",
"type": "Mesh",
"name": "Cylinder 4",
"geometry": "CCB3F065-632D-4AD4-AB16-6DC65D3F9163",
"material": "033485A5-CADB-4240-B01B-8EF94148626C",
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]
}]
},
{
"uuid": "280B1F69-8E93-442E-A49D-42BF45004313",
"type": "PointLight",
"name": "PointLight 1",
"color": 16777215,
"intensity": 1,
"distance": 0,
"decay": 1,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,-165.60302734375,0,-170.2801971435547,1]
},
{
"uuid": "44E76258-B0C2-43B1-99FB-0BE25D31972A",
"type": "Mesh",
"name": "Container 1",
"geometry": "D3905F27-8D63-447B-A4D2-D4901FAB00E2",
"material": "DD696C09-0225-446A-A040-CA9917C49D6A",
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,501.0995178222656,0,-383.1794738769531,1],
"children": [
{
"uuid": "A9FE3E04-1AE7-4A13-ADAF-706CE9361109",
"type": "Mesh",
"name": "Box 1",
"geometry": "0F1A7764-83AC-41AE-BB49-AE74A475CF80",
"material": "6B15E58A-F80D-4BC4-A1DE-185A846B6BBD",
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,-111.47900390625,1],
"children": [
{
"uuid": "3C7CB934-95EF-4327-9595-52A64AE40D2D",
"type": "Mesh",
"name": "Torus 2",
"geometry": "E69365CA-206A-4286-BB0D-940A804B7DEB",
"material": "BD2913CC-3A1F-45A7-8498-F90988426445",
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,16.59000015258789,0,108,1]
},
{
"uuid": "7B2F4D0F-D8C3-46EF-9600-EF39D9DFE590",
"type": "Mesh",
"name": "Sphere 3",
"geometry": "B2B3E2FD-17C5-42B3-8732-0918F4196199",
"material": "135C8BD4-895B-42C8-A72D-3FB356248D7A",
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,-169.27000427246094,1]
},
{
"uuid": "D6741C5F-2B08-432A-B671-11F538EC73DF",
"type": "Mesh",
"name": "Cylinder 4",
"geometry": "CCB3F065-632D-4AD4-AB16-6DC65D3F9163",
"material": "033485A5-CADB-4240-B01B-8EF94148626C",
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]
}]
}]
},
{
"uuid": "426C5B44-3DA4-4451-81B9-9CA53780411E",
"type": "Mesh",
"name": "Container 2",
"geometry": "EE1DB156-C18F-41B1-B1B5-E4B2619F6FC2",
"material": "7E04EF43-1516-433E-ABD1-42E303AA0F19",
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,488.5225524902344,0,548.1283569335938,1]
}]
}
}
This issue has been raised in the past by BuschnicK
I repeat the question here because if I use the clone operation, this created a copy in memory of the volume and its childs. Althaugh geometries and materials are copied but only the mesh and and positioning, it created a huge memory problem.
I would like to know if there is a way to position a volume by creating only a link to that volume whithout copying in memory all the information about the volume and its childs. This would save space on disk by a factor of 500-1000 and the same savings in memory.
I would appreciate any suggestion,
Thank you in advance,
Ilias
var temp = Box1.children;
Box1.children = [];
var newBox = Box1.clone();
Box1.children = temp;
??