玩意 is a slightly derogatory term for "things" or 东西。It implies this thing is either utterly useless, or exceedingly mundane, or shockingly simple. So, by asking "这是什么玩意儿？", not only the speaker asks for the nature of the object (what is it), but also shows that the speaker deprecates it.
Sometimes, it's used to solely express the disapproval of the existence of that thing, because otherwise the speaker would have used 东西 instead. Sometimes, especially for young people, they tend to overuse "玩意" for being cool. Because this belittling attitude implies they are better.
Since its derogatory nature, it is generally offensive to call anything as “玩意” in front of its creator. If you call anybody as 玩意, it is generally equivalent to calling them "不是东西". Except "不是东西" is more often to be a moral judgment, but "玩意" is a criticism of their capability.
Unlike 玩意 and 东西， 名堂 as a word is rarely used alone. Whenever you hear 名堂, it almost always is either a variant of "搞什么名堂" (negative tone) or a variant of "搞出点名堂" (positive tone). It is almost like a part of idiom and most Chinese people do not understand the literal meaning of 名堂.
Whether its positive or negative tone, 名堂 refers to a process or a result of people's activities. This is distinct from 玩意, as 玩意 refers to an object.
Please note, 名堂 in itself is not negative at all. It even has some positive aspect to it because 堂 is mostly related to formality. The negative tone of "你在搞什么名堂" comes from the fact that people only say this to try to interrupt processes they deem inappropriate. Otherwise, they say 加油 to encourage it. People are not always lucky enough to be around to stop inappropriate processes. So you might hear people say "这搞的什么名堂". The added 的 is an emphasis on past tense, indicating 名堂 is a consequence that needs investigation. When used in this way, it only shows the initial disapproval attitude of speaker when he first see to the situation (which is seemingly bad). It does not guarantee the result is actually negative. Thus it is more or less a neutral phrase signalling a potential criticism after investigation. Comparing to "这搞的什么玩意", if 玩意 is used, it means the speaker has committed to criticize.
But because the word 名堂 itself has some positive tone, it should not be hard to understand "搞出点名堂" means making some achievement. It implies that the speaker does not have a plan yet but want some change. Usually when it is used, it implies the speaker is in some hardship who seeks a rapid change of his situation, and it does NOT imply the achievement is morally correct. If a thief said this, he probably means stealing something great to make his name out in gangdom.
An interesting note: People who seeks to "搞出点名堂" almost always end up blowing it all up and become worse off. Because success flavors people who have a plan for their dreams instead of dreaming for a plan