- This topic has 10 replies, 5 voices, and was last updated 1 year, 12 months ago by fred7.
-
AuthorPosts
-
2019-09-05 at 5:34 pm #18449GLiFTeKCustomer
i’ve loaded a csv into a list table.
i’m having difficulty specifying how to retrieve a specific block from it.
i want a variable to take the value of what is in the first column of the first row of my list.
any suggestions?Visit the GLIFTEK Verge3D Plugins Store!
GLIFTEK.com for Plugin Documentation & LIVE DEMOS!
LIKE The GLIFTEK Facebook Page for updates!
Join the Verge 3D Discord Server!
plz share Discord link & on your signature!2019-09-06 at 6:38 am #18466Yuri KovelenovStaffPlease take a look at this example: https://www.soft8soft.com/docs/manual/en/puzzles/Misc.html#read_CSV
2019-09-06 at 7:31 am #18468GLiFTeKCustomerPlease take a look at this example: https://www.soft8soft.com/docs/manual/en/puzzles/Misc.html#read_CSV
right!
I’ve learned from.. and USE that example (modified for me) in my steps to retrieve certain row cells for certain queried row vars! :) successfully! it’s been great using this function.however.
I don’t know how to look for COLUMN 1, ROW 1’s cell. using the puzzles the way they are arranged.
i would think that i would do this:
but i can only say “#” not “item” …
list in list etc..
see image..Visit the GLIFTEK Verge3D Plugins Store!
GLIFTEK.com for Plugin Documentation & LIVE DEMOS!
LIKE The GLIFTEK Facebook Page for updates!
Join the Verge 3D Discord Server!
plz share Discord link & on your signature!2019-09-06 at 8:03 am #18472Yuri KovelenovStaff2019-09-06 at 11:54 pm #18489GLiFTeKCustomerthanks for the response, Yuri.
works PERFECT!
Visit the GLIFTEK Verge3D Plugins Store!
GLIFTEK.com for Plugin Documentation & LIVE DEMOS!
LIKE The GLIFTEK Facebook Page for updates!
Join the Verge 3D Discord Server!
plz share Discord link & on your signature!2022-08-31 at 3:37 pm #55417fred7CustomerHello Yuri,
I need the same and unfortunetly I didn’t get it to work with your examples.What I wand to archieve:
I have a CSV-File where the first column stores RAL-colors and the second column is the corrsponding hex-color value.In my parent HTML UI document there are buttons with the IDs of the first column.
When one of those buttons is clicked, I want to have the color of one material changed to the correct hex-color value.
How to do that?
Thank You!
Attachments:
You must be logged in to view attached files.2022-08-31 at 5:39 pm #55427kdvParticipantLoops and global variables lead to really strange things in V3D )))
VARS.listOfColorPairs.forEach(function(list) { const elem = parent.document.getElementById(list[0]); elem.addEventListener('click', function() { PROC.changeColor(list[1]); }); });
This MUST do the same, BUT it won’t work as expected )))
function changeColor(color) { setMaterialColor('alpha_hashed', 'Principled BSDF Color', 0, 0, 0, color); } loadFile('./colors.csv', function() { listOfColorPairs = readCSV(_pGlob.loadedFile, ';', 0); for (var list_index in listOfColorPairs) { list = listOfColorPairs[list_index]; eventHTMLElem('click', list[0], true, function(event) { changeColor(list.slice(-1)[0]); }); } });
The problem is in the global variable
list
that must be local inside the loop. It must beconst
orlet
to work properly…Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2022-09-01 at 10:11 am #55446Ivan LyubovnikovStaffThanks for raising this issue! It affects the for_each and count_with puzzles. We will fix it in the next Verge3D release by making the corresponding variables local.
As for now to make it work you can apply the following workaround: https://www.soft8soft.com/topic/add-dragging-and-methods-to-a-list-of-objects/#post-26503
Co-founder and lead developer at Soft8Soft.
2022-09-01 at 10:58 am #55448kdvParticipantyou can apply the following workaround
Confirmed. The workaround is working
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2022-09-01 at 12:05 pm #55462fred7CustomerThank you very much! Works perfectly!
2022-11-23 at 9:36 am #58362fred7Customeredit: Did also post the question into this thread, as it makes more sense there:
Hello,
this was working great, but unfortunately I need to switch to a JSON as loaded data. Can anyone help me out to have the same functionality just with a JSON? Would be amazing, as I am struggling to understand it. Please see the JSON attached. 1000, 1001, 1002,.. should be IDs in the parent doc and if one of the buttons is clicked, the corresponding RGB value should be used for the set color puzzle.Many thanks!
Attachments:
You must be logged in to view attached files. -
AuthorPosts
- You must be logged in to reply to this topic.