Author Topic: Get parameter value by name  (Read 883 times)

0 Members and 1 Guest are viewing this topic.

Offline bitterfitterTopic starter

  • Senior Member
  • ****
  • Posts: 450
  • Country: us
  • Gender: Male
Get parameter value by name
« on: Apr 21, 2022, 18:58:46 PM »
I am looking to use the "get parameter value by name" node to fill in the hanger name in my point export script.  No matter what I try, I can't get the value to fill in.  Can someone tell me what I should be entering for a parameter name in my code block?  I would like to get the "source description " if possible but I just can't seem to access it.
"If you think education is expensive, you should see what ignorance costs you"

Offline Axl

  • Full Member
  • ***
  • Posts: 126
  • Country: us
  • Gender: Male
Re: Get parameter value by name
« Reply #1 on: Apr 21, 2022, 20:29:49 PM »
A couple ways I do it,

Option1
Use the node "Parameter.ByName" not the "ValuebyName" and connect a String node with: "Family" see the attachment "elementnamev1" there is a long explanation for that, but for short just swap the node.

Option2
Create a function:
Code: [Select]
def getParam(ele, param, listr):
try:
paramt = ele.LookupParameter(param)
para = paramt.AsString()
listr.append(para)
return para
except:
return None

Then call the function with any parameter that has a string value (it doesn't work for numeric values):
Code: [Select]
TransactionManager.Instance.EnsureInTransaction(doc)
prodname = getParam(<elementID>,"Product Long Description", <name of list you wanted to be added>)

Option3
I call it the cheating way, use the node "Parameters" that list all the parameter of the element, then do a get item at index node to get the value of that specific parameter see attachment elementnamev2, just be careful because only works on element that has the value that you want in the same position (index) or you will get random results, see attachment "elementnamev2"
CADmep DB Manager
Content Manager
Scripting

Offline bitterfitterTopic starter

  • Senior Member
  • ****
  • Posts: 450
  • Country: us
  • Gender: Male
Re: Get parameter value by name
« Reply #2 on: Apr 22, 2022, 14:26:46 PM »
Once again, thanks AXL.  I do love to have choices.  Do you have an idea of why my Product Long Description parameter would come up blank?
"If you think education is expensive, you should see what ignorance costs you"

Offline madcad

  • Senior Member
  • ****
  • Posts: 302
  • Country: gb
  • Gender: Male
Re: Get parameter value by name
« Reply #3 on: Apr 22, 2022, 15:38:12 PM »
Did Revit have access to the Prodinfo.map when you reloaded the config.
All the parameters beginning with Product are read from there.

Offline bitterfitterTopic starter

  • Senior Member
  • ****
  • Posts: 450
  • Country: us
  • Gender: Male
Re: Get parameter value by name
« Reply #4 on: Apr 22, 2022, 16:07:46 PM »
I have the hangers, I am using in my model, filled into the product info.map.  Is it possible that Revit is not accessing this some how?  I have to admit I have been using Fab MEP for sometime but have rarely used the product info editor until recently so I am not very familiar with how they work together.
"If you think education is expensive, you should see what ignorance costs you"

Offline Axl

  • Full Member
  • ***
  • Posts: 126
  • Country: us
  • Gender: Male
Re: Get parameter value by name
« Reply #5 on: Apr 22, 2022, 18:03:11 PM »
If the "id" code in the PRODINFO matches the "id" code in the item product list and both descriptions fields are filled in, then it should show, but as you said, Revit some times is not able to see it, if it is that the case, then you need to use the script code in the option 2 the code bypasses Revit and ask directly PRODINFO but it has to be correct if you want it to work.

I usually match the fields, "Description" and "Source Description" because some reports uses one and other reports uses the other field, this will also make your script easier.

EDIT: Also you need to "Reload Services" after any change to prodinfo or the items, in case you didn't know that.
CADmep DB Manager
Content Manager
Scripting

Offline madcad

  • Senior Member
  • ****
  • Posts: 302
  • Country: gb
  • Gender: Male
Re: Get parameter value by name
« Reply #6 on: Apr 22, 2022, 18:10:14 PM »
Prodinfo.map should be in the Database folder.
Why don't you create a Revit Schedule and bring across every available Parameter. That will tell you what is working and what is not.
Always keep an excel copy of the prodinfo, populate this and copy/paste the cells into the prodinfo editor. Paste into the green line after the last entry.

Offline bitterfitterTopic starter

  • Senior Member
  • ****
  • Posts: 450
  • Country: us
  • Gender: Male
Re: Get parameter value by name
« Reply #7 on: Apr 25, 2022, 19:21:55 PM »
Thanks AXL and madcad for the help.  I was able to get the info I needed out of the editor finally.  I had some ID numbers incorrect.  :(  Now after going through this experience in the product info editor, I see where I am going to have a few questions on how you guys are setting up your hangers for Revit.  But this is for a new thread.....
"If you think education is expensive, you should see what ignorance costs you"