asdasdasd
Change prefix attribute programmatically with API Script
Hi! I'm new in the use of javascript and i'm trying to write a script that copy a component, place it in a specified position and then change its suffix. The js code i wrote copy and move correctly the new component but when i change the prefix it doesn't change on the screen while in the attribute i can see it correctly like shown in the picture. Can anyone help me? The code is the following: create_TP("gge2",2.54,2.54,"TIP2"); function create_TP (id,x_mm,y_mm,reference) { var newId = api('clone', {ids:[id]}); // create clone api('moveObjsTo', {objs:newId, x: api('unitConvert', {type:'mm2pixel',value:x_mm}), y: api('unitConvert', {type:'mm2pixel',value:y_mm})});     var json = api('getSource', {type:'json'}); json.FOOTPRINT[newId].TEXT[Object.keys(json.FOOTPRINT[newId].TEXT)[0]].text="TP2"; //alert(json.FOOTPRINT[newId].TEXT[Object.keys(json.FOOTPRINT[newId].TEXT)[0]].text); api('applySource', {source: json, createNew: !true}); } Thank you. Andrea. #PCB#
112358 2018-10-29 14:45:47 comment 2 0 Circuit Design