Community
AutoCAD MEP Forum
Welcome to Autodesk’s AutoCAD MEP Forums. Share your knowledge, ask questions, and explore popular AutoCAD MEP topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

property set definition

38 REPLIES 38
Reply
Message 1 of 39
Anonymous
2169 Views, 38 Replies

property set definition

Hello,

I'm trying to create a property set definition to schedule model dimensions
from a custom parametric MV Part, for example the dimension LenA1.

I have:
1) Inserted part
2) Created a new property set definition.
3) Selected object type definition.
4) Selected MV Part for applies to.
5) Set the parameter to auto.
6) Source: Tried various settings. This seems to be where I'm having
trouble. There is no size or value setting. What should I be picking for
source to retrieve the value of LenA1?

On a side note can these property set definitions be saved with the MV Part
in the catalog so that they are automatically attached to the part at
insertion?

Thanks,

Shane
38 REPLIES 38
Message 21 of 39
VitalyF
in reply to: NotFromFrance

PS

 

("AecX.AecScheduleApplication.7.7") - MEP2015

("AecX.AecScheduleApplication.7.5") - MEP2014

("AecX.AecScheduleApplication.7.0") - MEP2013

Message 22 of 39
Keith.Brown
in reply to: VitalyF


@Anonymous wrote:

 

...


 

Nice solution using property sets VitalyF.

 

I took your solution and made it work for all current versions of MEP going back to 2010 and also made it work for all mvpart styles.  This way you can use the single property to report the weight for all types of mvparts.

 

This technique is useful for collecting all the data of different styles and placing into an object based property set for scheduling purposes.

 

 

On Error Resume Next
Set app = GetObject (,"AutoCAD.Application")

acadVerString = app.ActiveDocument.GetVariable("ACADVER")

'Set MEP application string, based on version running: 
Select Case acadVerString 

	Case "18.0s (LMS Tech)"  'MEP-2010 
		aecBaseVer = "AecX.AecScheduleApplication.6.0"

	Case "18.1s (LMS Tech)"  'MEP-2011 
		aecBaseVer = "AecX.AecScheduleApplication.6.5"

	Case "18.2s (LMS Tech)"  'MEP-2012 
		aecBaseVer = "AecX.AecScheduleApplication.6.7"

	Case "19.0s (LMS Tech)"  'MEP-2013 
		aecBaseVer = "AecX.AecScheduleApplication.7.0"

	Case "19.1s (LMS Tech)"  'MEP-2014 
		aecBaseVer = "AecX.AecScheduleApplication.7.5"

	Case "20.0s (LMS Tech)"  'MEP-2015 
		aecBaseVer = "AecX.AecScheduleApplication.7.7"

	Case Else 
		aecBaseVer = "Unknown" 

End Select 

If aecBaseVer = "Unknown" Then 
	RESULT = "Unknown MEP Version" 
Else

	RESULT=" ** Unable to get property value from style **"
	Override = [WeightOverride]
	Set sched = app.GetInterfaceObject(aecBaseVer)

	partStyle = "[PartType]"
	stylePropertySetName = "MvPart" + Replace(partStyle, " ", "_") + "Styles"

	mvpartPropertySet = UCase(stylePropertySetName)
	Set vobj = app.ActiveDocument.ObjectIDtoobject ( [ObjectID] )
	set style = vobj.Style
	set propSets = sched.PropertySets(style)
	For Each propertySet In propSets
		if UCase(propSet.Name) = mvpartPropertySet Then
			For Each prop In propertySet.Properties
				If UCase(prop.Name) = "WEIGHT" Then
					If Override <> 0 Then
						RESULT = Override
					Else 
						RESULT = prop.Value
					End If
				End If
			Next
		End If
	Next
End If

 

** Edit **  changed the version for MEP 2015 from "19.2s (LMS Tech)" to "20.0 (LMS Tech)".  They modified the API in 2015 that required them to break from their usual numbering scheme.  note the file format did not change for 2015.  It is still compatible with 2013 and 2014.

Message 23 of 39
Keith.Brown
in reply to: NotFromFrance


@Anonymous.french32 wrote:

...

   


If you are just doing simple things like this then using property sets or vba is ok.  If you would like to do some heavy custimization then you should probably get Visual Studio express and start learning C# and then start learning the AutoCAD .Net API.  Finally you will then need to learn the MEP .Net API.  A word of warning, there is very little documentation on using the MEP API but there are a few people who have cracked how to use it and are willing to share what they know.  

 

I am able to do alot of things using the API but my knowledge falls far short compared to others.  But I am willing to help if you need it.

 

Additionally everything takes twice as long or longer to program using .Net but the payoff is alot larger.  Plus it is easy to create reusable libraries so you only have to write the code for most things once if your smart about how you go about it. 

 

p.s.  I recommend using C# vs VB.Net because there are alot more examples around the internet using C#.

Message 24 of 39
NotFromFrance
in reply to: Keith.Brown

Thanks, Keith, you have been very helpful!  The solution above worked for all MvParts, so now I need to modify it or create new Property Set Definitions for Pipe Fittings and Pipe. 

 

My vba macro will export the weights and coordinates for each part into an Excel spreadsheet which will then be copied into a 3rd party Pipe analysis software (RISA 3d) as joint loads.  It sounds like with C# programming, I might be able to skip the Excel spreadsheet and export directly into RISA 3d.

 

btw, if you have any suggestions on how to enter the unit weight for each material type and size of pipe, so that I can get the total weight of each pipe section, that would help me speed things along.

Message 25 of 39
Keith.Brown
in reply to: NotFromFrance

Hi Adam,

 

Here is an updated property set that should work for mvparts, pipe, and pipefittings.  You will need to modify it if you want it to work for pipe flex fittings and pipe custom fittings.

 

On Error Resume Next
Set app = GetObject (,"AutoCAD.Application")

acadVerString = app.ActiveDocument.GetVariable("ACADVER")

'Set MEP application string, based on version running: 
Select Case acadVerString 

	Case "18.0s (LMS Tech)"  'MEP-2010 
		aecBaseVer = "AecX.AecScheduleApplication.7.0"

	Case "18.1s (LMS Tech)"  'MEP-2011 
		aecBaseVer = "AecX.AecScheduleApplication.7.0"

	Case "18.2s (LMS Tech)"  'MEP-2012 
		aecBaseVer = "AecX.AecScheduleApplication.7.0"

	Case "19.0s (LMS Tech)"  'MEP-2013 
		aecBaseVer = "AecX.AecScheduleApplication.7.0"

	Case "19.1s (LMS Tech)"  'MEP-2014 
		aecBaseVer = "AecX.AecScheduleApplication.7.5"

	Case "20.0s (LMS Tech)"  'MEP-2015 
		aecBaseVer = "AecX.AecScheduleApplication.7.7"

	Case Else 
		aecBaseVer = "Unknown" 

End Select 

If aecBaseVer = "Unknown" Then 
	RESULT = "Unknown MEP Version" 
Else

	RESULT=" ** Unable to get property value from style **"
	Override = [WeightOverride]
	Set sched = app.GetInterfaceObject(aecBaseVer)
	Set mepObject = app.ActiveDocument.ObjectIDtoobject ([ObjectID])
	multiplier = 1

	partStyle = "[PartType]"

	If mepObject.ObjectName = "AecbDbMvPart" Then
		stylePropertySetName = "MvPart" + Replace(partStyle, " ", "_") + "Styles"
	End If

	If mepObject.ObjectName = "AecbDbPipe" Then
		stylePropertySetName = "PipeStyles"
		multiplier = mepObject.CutLength
	End If

	If mepObject.ObjectName = "AecbDbPipeFitting" Then
		stylePropertySetName = "PipeFitting" + Replace(partStyle, " ", "_") + "Styles"
	End If

	partPropertySet = UCase(stylePropertySetName)
	set style = mepObject.Style
	set propSets = sched.PropertySets(style)
	For Each propertySet In propSets
		if UCase(propSet.Name) = partPropertySet Then
			For Each prop In propertySet.Properties
				If UCase(prop.Name) = "WEIGHT" Then
					If Override <> 0 Then
						RESULT = Override
					Else 
						RESULT = prop.Value * multiplier
					End If
				End If
			Next
		End If
	Next
End If

 

Changes that were made:

 

1.  Update the AppliesTo tab to include Pipe and PipeFittings.

2.  Update the ObjectId property to include Pipe and PipeFittings

3.  Update the Parttype property to include Pipe and PipeFittings

4.  Modified the code so that the StyleBased property set name was constructed based on the object type

5.  Finally if the object was a pipe then the stylebased property set value was multiplied by its cutlength

 

Obviously in order for it to work each pipe, pipefitting, and mvpart need a custom parameter added to it named Weight.  In addition for pipe, the Weight value should be equal to the Weight of 1 Unit Length.  In imperial units this is in Inches.  Most manufacturer catalogs that have the weight listed have it listed for 1" I believe.  If not then you will need to convert it.

 

If you stretch the pipe in the sample drawing included you will see that the pipe weight changes when its length does.  If you would like to the WeightOverride to be a unit weight for the pipe also instead of the weight for the entire pipe then multiply it by the multiplier also.

 

So this section of code

 

					If Override <> 0 Then
						RESULT = Override
					Else 
						RESULT = prop.Value * multiplier
					End If

 

would become

 

					If Override <> 0 Then
						RESULT = Override * multiplier
					Else 
						RESULT = prop.Value * multiplier
					End If

 

I hope this is what you wanted and I explained it well enough.  I had actually had fun trying to get this to work.  Also thanks to VitalyF for providing the initial code.  I just did a little modification to it to get what you wanted.

 

 

** Edit ** I had inadvertantly left part of the code for the PipeFitting style commented out.  I removed the comment and added another pipe size to the drawing to verify it was working correctly.

Message 26 of 39
Keith.Brown
in reply to: Keith.Brown

I edited the post immediately above.  I had left a comment in the code that caused it to fail for a pipe fitting.  The sample drawing and the code shown should now be correct.

Message 27 of 39
Keith.Brown
in reply to: Keith.Brown

One more thing to mention about scheduling.  If the Weight property is not found on an object then the following will display for the property.

 

** Unable to get property value from style **

 

If you are scheduling and hoping to obtain a total weight then this will cause the schedule to fail.  To get around it you can change the value from the message above to a 0 instead.  This way something with a zero weight will indicate failure to obtain the value.

 

Or you could use a formula column in your schedule and check to see if the value is equal to the message above and if so then set the value to zero.  I prefer this method.  I can't give you a concrete reason why other than when looking at the individual objects in the model it is easier to see if the property set has failed to obtain a weight.

 

You should also check for Unknown Version which would indicate that you either need to update the property set for 2016 and above products or you have more than one instance of AutoCAD MEP open.  Using these type of vbscript in the property sets will fail if more than one instance of the program is open.  If that happens then you will need to shut them all down and reboot in order to get the property value to display correctly again.

Message 28 of 39
VitalyF
in reply to: Keith.Brown

Hi Keith,

 

Too many conditions, is not it?

In this case it is not a good idea to change the MEP on the script function!? It's like a ticking time bomb.

That would avoid confusion in the future, more correctly add Weight to the catalog each time!

This is what I think! I dare swear! Those who will use these formulas should be aware of this!

Message 29 of 39
Keith.Brown
in reply to: VitalyF


@Anonymous wrote:

Too many conditions, is not it?


I don't think so.  For me it is safe to say that the amount of drawings that use my templates number in the hundreds of thousands and there have been no reported issues that I can link back to the amount of conditional statements.

 


 It's like a ticking time bomb.


I don't quite know what is ticking about it?  As i said above I have been using this method for a couple of years with hundreds of customers.  Based on the volume of their work it is safe to say that the amount of drawing created based on these templates and property sets is extremely high and again there have been no issues that i can trace back to the number of conditional statements that query the application for its version.  As i mentioned above the only downside is that having several copies of MEP open at the same time will cause the property set to fail.

 


That would avoid confusion in the future, more correctly add Weight to the catalog each time!


Yes this would be the ideal solution but unfortunately it will not work for about 90% of my clients.  Most of them use different versions of MEP in the same office and need a template that is flexable.  This gives them that flexability.  I do recomend for them that they drop off the lowest versions of the software that they no longer use.  For instance, if they are only using 2013, 2014, and 2015 then there is no reason to keep the 2010, 2011, and 2012 checks in the property sets.

One recommendation that I would make would be to seperate the multi-view parts from the other objects.  From a scheduling point of view I see no real value in having them in the same schedule and it would help optimize the property set formula.  I would also add a break in the for each statements when the correct value is found.  In this case, i chose not to do it in the sample code as most objects only have 1 or 2 style based property sets and the properties in those styles are not overly large in number.  I also did this to make the code more readable but to be correct there should be checks to see if the value was found and them immediately exit the loops.

 

I respect your opinion and in an open forum like this it is always good to have many opinions on how to do something.  My approach to situations like this is to answer the original question to the best of my ability and lay all of the options out on the table and let the customer decide what is best for them.  

 

 

 

 

 

Message 30 of 39
VitalyF
in reply to: Keith.Brown

Hi Keith,

 

If you do not create a new entry in the catalog and override its value from the object, then we obtain: 

      a) two data sources, not one, first weight from catalog, second from user files

      b) one mvpart can have multiple values for different users

      c) multiple mvparts can have the same value of "Weight"

      d) etc....

 

 It's like a ticking time bomb. - 

our script it's like a time bomb, over time get confusion

 

I am sorry for my english ((

Message 31 of 39
Keith.Brown
in reply to: VitalyF

Hi VitalyF,

 

I don't quite understand what you are trying to say.  It is probably a language barrier.  

 

(a) I think you are saying that every object in the part catalogs need their own "weight" property.  

(b) And that the weight property can come from the either the catalog (style property set) or from the override (object property set).  

(c) Finally, since the weight comes from the catalog and is in a style based property set then multiple parts will have the same weight?

 

I would agree with all of those.  In order for this to work well the "Weight" parameter should be added to each object in the user's catalogs.  Each user should be using the same catalogs from a network location so that the values are identical. (We have moved our catalogs to a sql database within a SQL Server.  Each company has their own SQL Server and everyone loads their parts from this server.  From within the same company everyone has access to the exact same part with the exact same data.)  99% of the time the weight property on the style based property set (comes from the server based catalog) should be the weight that is used.  If for some reason the weight needs to be changed then the user can use the override property to change the weight value.

 

Users that have laptops and need to use them without access to the server database can have a local copy of the database installed on their laptop.  Some companies setup their databases to create a local copy every night on the mobile workstations so that they are always working with the most up to date version of the database.

 

One of the things that is key is that all users should be using the same catalogs.  Every company can get the same setup with the catalogs that ship with AutoCAD MEP by moving those catalogs to a central location and repath the individual users catalogs to those new locations.  All company parts or parts that have been modified should be placed in a company catalog that will not get overwritten with each new release of AutoCAD MEP.

 

If those policies are followed everything should be ok.

Message 32 of 39
VitalyF
in reply to: Keith.Brown

(a) (b) (c) - yes, of course!

 

If those policies are followed everything should be ok.

 

Then this script is not for everyone, but only for your company!

Otherwise you have to put the user manual for working with the script

And warn other users about the future effects

 

Message 33 of 39
Keith.Brown
in reply to: VitalyF

You provided the script!  I just made the changes to make it universal for different versions of MEP and for all types of MEP objects.

 

If you work in a multi-user environment and the users all not all working from the same catalogs then you are just asking for trouble with anything that you do.  Basic AutoCAD MEP philosophy.  This is true for any piece of software that is being used in a multi-user environment.  All users must be working with the same data.  

 

The same is true for drawing templates and drawing styles.  Everyone should be on the same template or you can be opening a "can of worms".  If someone makes a change to any style in any drawing then it could of course have ramifications to their existing drawings and to any future drawings.  Any user needs to fully understand the changes that they make and how it will effect their company and their company's bottom line.  This is why some project managers make their catalogs and their templates read only.  To make sure that no unautherized user can change their setup.  In addition, project synchronization can insure that it stays that way.

 

 

Message 34 of 39
VitalyF
in reply to: Keith.Brown

You provided the script!  I just made the changes to make it universal for different versions of MEP and for all types of MEP objects.

 

 

Yes, I first made the script, but then I thought about its effects

I hope that other people will read this message and take note

 

 

Message 35 of 39
Anonymous
in reply to: Anonymous

I really appreciate if someone answer at least one of the topic's main question. 

Particularly, i wonder if someone knows, where is the default Property Sets Definitions for MEP parts are specified? I cannot find any "AecbPropertySetDefinitions.dwg" file or "Aecb Shared Content 3" folder, as stated before, i'm using MEP 2016. I suppose these files are obsolete, and were used in previous versions of application, but i guess there should be alternative approach, other than using VBA scripts. 

I still need to reference to Catalog Parts' Size Parameters to pass the values to Properties Sets and, subsequently, to Schedules.

 

This is like a tricky magic for me. I have a catalog, developed by third-party organization for our company a couple years ago, and for several reasons, I cannot contact them, and, therefore, cannot find out how to manage this problem. Say, we have a regular MEP pipe catalog. When I insert, say, a new pipe from this catalog, new style-based Property Set Definition is created, called "PipeStyles", and it contains only one Property Defnition: "Supplier name". Where is this PSD specified? I mean which file should I edit to specify my very own auto-creating-on-insertion prop. sets. defs? Further, in this automatically created PSD I am able to create Automatic Property Definition, say, Catalog Nominal Size, and it strictly refers corresponding Parameter of the catalog part. But this method cannot be applied to other parameters, the reason is mystery for me. Are there any approaches to archive my objectives?

 

Thanks in advance. 

Message 36 of 39
Keith.Brown
in reply to: Anonymous

I will try to answer your questions as best as I can.

 

Q. where is the default Property Sets Definitions for MEP parts are specified.

A. The style based property sets that you see on an MEP part come from the part definition themselves.  They are taken from the data that is stored on the part and created when the part is inserted into your drawing.  If you need to modify this data then you should open up the part using Content Builder or using the Catalog Editor and modify the data there.

 

Q. which file should I edit to specify my very own auto-creating-on-insertion prop. sets. defs

A. Again if you need a style based property set then you add the information using the content builder or the catalog editor.

 

If you don't understand the difference between style based property sets and object based property sets then this might help you understand.

 

You don't edit any files to create a property set.  You go into the style manager and define the style for the property set creating either an object based or style based property set.  You can go into the properties and then in the AEC Object Settings tab select Automatically Attach to have your property sets automatically attach to the objects when they are inserted.

 

If you are interested in where AutoCAD MEP stores its styles you can look in this directory.  C:\ProgramData\Autodesk\MEP 2016\enu\Styles.  This is where you will see where the display configs, tags, schedules, etc are stored.

Message 37 of 39
Anonymous
in reply to: Keith.Brown

Thanks for your reply, Keith, i really appreciate your help, but this is not clear to me yet.

Let's proceed with the steps I've performed, to find what exactly i do is wrong.

 

For example, i start with the plain acadiso3D template (to be sure that these steps may be performed on other system identically). As shown on pic 01, in Style Manager, there are no predefined PSDs, like "PipeStyles" etc. Than I create a bunch of pipes and fittings from standard acad catalog, in this case, butt welded HDPE, as shown ob pic 02. As we can see on pic 03, some new PSDs were auto-created, applies to fittings and pipes. I'll go then to the content builder, and open parts that i've recently inserted (pic 04). And this step is most important. Where exactly are these "PIpeFittingElbowStyles" and "PipeStyles" are defined? All I can see in content builder (pic 05) is part constructor layout, and there are no control elements there, which allow me to create and/or edit some "auto-creation" PSDs, related to this part. Same for Catalog editor.

Next, as i type on pic 05, i need to acquire some parameters of the part, to pass them to the schedule table. As was stated previously in this topic (if i understood methodology) I open the existing "PipeStyles" PSD (pic 06), and create new manual definition, with the name, corresponding to one of the part's parameters (pic 07). Than i create new object-oriented PSD, say, i call it "PipeObject" (pic 08), and create new manual definition, called "ConnectionNominalDiameter", and specify "PipeStyles:D1" in "Starts with" field when creating it (pic 09). As you can see on the last pic 10, both fields "D1" and "ConnectionNominalDiameter" are empty.

Please help me to find out what's wrong in this routine?

Message 38 of 39
Keith.Brown
in reply to: Anonymous

Problem #1 and probably the root cause of all of your problems.  You are in AutoCAD MEP.  You need to use an AutoCAD MEP Template.  The template you are using is for autocad.

 

You can find the start template at C:\ProgramData\Autodesk\MEP 2018\enu\Template.  Please choose one of the AECB Model templates that correspond to your catalog types.  Change the path of the templates to your version of MEP.

 

In order for the data to come over from the part you need to add Custom Data to the part that is a calculation that points to the data that you want to show.  Make sure that you set the data visible and that the description is set correctly as it is the name that is shown.

 

A video showing the process is below.  Its been awhile since i have done this so there are a few mistakes that I correct in the video but the end result is the data showing up in the style based property set.  Make sure that you start with one of the above mentioned templates.

 

 

 

Message 39 of 39
Anonymous
in reply to: Keith.Brown

Ok, i got it now. Marvelous! Everything works just fine! Thank you very much.


@Keith.Brown wrote:

Problem #1 and probably the root cause...

 

...

 

...Make sure that you start with one of the above mentioned templates.

 

 

 


 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report