I'm a newcomer, and I'm studying the SKILL. I wrote some code to report the dummy net pin and single pin( or unconnected pin), then asign the list to a form, browse them one by one. But one problem occured. For some projects, there is a error information for strcat command: Error* strcat: argument #1 should be either a string or a symbol The part of code is like this: let((Pin_List Dummy_Pin_List Single_Pin_List) Pin_List=Dummy_Pin_List=Single_Pin_List=nil foreach( item Pin_List if(item->net->name=="" then Dummy_Pin_List=cons(strcat(item->component->name "." item->number) Dummy_Pin_List) Dummy_Pin_List=sort(Dummy_Pin_List 'alphalessp) else if(length(item->branch->children)==1 then Single_Pin_List=cons(strcat(item->component->name "." item->number " / " item->net->name) Single_Pin_List) Single_Pin_List=sort(Single_Pin_List 'alphalessp) );if );if );foreach );let Who can help me with this problem. thanks.
of course The Pin_List is generateed by below code: axlDBRefreshId(axlDBGetDesign()) axlClearSelSet() axlSetFindFilter(?enabled '(noall pins) ?onButtons '(noall pins)) Pin_List=axlGetSelSet(axlAddSelectAll())
You are getting every pin record in the board database. Some of theins may be mechanical pins which have no number value. Then when you strcat item -> number strcat fails as you are seeing. Try adding a conditional that traps null item -> numbers For example if(item -> number != nil then
OK, thank you very much for your answer. I'll try it soon~~~
Another technique to address unwanted nil values is to use OR: strcat(x y item->number||"" z) Since 'or' stop evaluating on non-nil ("true") values from left to right. And not related to your question - you should sort once after the foreach statement (for improved performance).
Ok, the reason is: for the mechanical pin, item->component=nil item->nuber=""(null) I ignored it~~~