AutoCAD Inventor :: Check If IProperty Exists In Component?
Apr 9, 2013
I am simply trying to traverse an assembly, check each component for existance (or value of) an iProperty, and if so add that components name to a list. Here is what I have, but it doesnt work.
'Define the open document
Dim oDoc As Document = ThisDoc.Document
Dim oRefDoc As Document
The following code adds three user parameters to an .ipt:
Public Sub AddUserParams() Dim oDoc As PartDocument Set oDoc = ThisApplication.ActiveDocument
[Code].....
If I run this on a part that already contains any of these user parameter names I get an error. Is there a way to first check for each name and skip to the next if it already exists?
Also, how the heck do I set ExposedAsProperty for each of the parameters added?
I have an assembly with parameters named the same as LOD's.
The parameters are set to equal the mass of the corresponding LOD's using ilogic.
If the LOD does not exist, I want to set the mass of the corresponding parameter to a value of zero.
I don't know how to check for the existence of the LOD and I'm not sure I can have three commands in the ELSE section.
Below is an example of what I need using a Parameter and LOD called EXTERNALS as an example.
If EXTERNALS LOD does not exist THEN Parameter("EXTERNALS")=0 ELSE 'activate the EXTERNALS LOD ThisDoc.Document.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("EXTERNALS").Activate
I found this code to create a custom iProperty in the current, open document:
Dim propertyName As String = "MyProperty"Dim propertyValue as String = "Test Value"customPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")Try prop = customPropertySet.Item(propertyName)Catch ' Assume error means not found customPropertySet.Add("", propertyName)End TryiProperties.Value("Custom", propertyName) = propertyValue
I have a iLogic rule that goes through each component of an assembly, counts how many times it occurs in the assembly, and then assigns that value to an iProparty (i.e. it inserts the total quantity of the part in some iProperty). Currently, however, it assigns the value to a default iProperty value, "Authority". I'd like, instead, for it to assign it to a custom iProperty called "Total QTY". However, I don't know how to tell Inventor to do the above code for a component in the assembly rather than the assembly itself. Below is my entire code. I've labeled where I'm guessing the above code should go. How I'd modify the above code to create the iProperty in the component being processed by the rule at that point?
Current
''True comment: Begin '''Commented-out Begin '''PartDocumentObject = 12290''AssemblyDocumentObject = 12291Dim openDoc As DocumentopenDoc = ThisDoc.DocumentDim docFile As DocumentIf openDoc.DocumentType = 12291 Then''If the open document is an assembly:''For each document referenced in this document:For [code]......
I am working on a project to assign balloons to components in drawing view automatically. Of course, I don't want to assign a balloon to a component which is invisible (hidden) in this drawing view.
So, is there any API function to check whether the component in the drawing view is invisible or hidden?
I'm looking to see if there is a way to link the revision number to a custom iProperty in the same part. Our laser requires a specific output for programming, but I only want this to show up on actual lasered parts as we don't need it on parts that are sawcut. Basically what I would like to do is create a custom iProperty that I can link to the title block for that reads RV:<Revision>. Is there a way to do this? I'd rather not create a separate drawing template for lasered parts as we've got about 100 templates for our various customers the way it is.
We are having an issue when we replace a component in Inventor Pro 2012. When we replace a component, the name in the browser does not update to the new component. We've even tried to close and re-open the Inventor assembly and that does not work. We end up manual double clicking the name in the browser and type in the new component name.
Inventor Product Design Suite Ultimate 2012 Dell Precision T7500 Workstation Xeon Processor 16 GB of RAM Nvidia Quadro FX 5800 Windows 7 x64
II need a way to tell if a component occurence is a virtual component.
I'm using a For Each loop to cycle through all of the components in an assembly, and if the component is itself an assembly to set the LOD to "Custom". I'm using the definition document descriptor object for this. It all woks fine until the loop comes across a virtual component which doesn't have a definition document, so I need a way to check if the component is virtual and needs to be skipped.Here's the
Option ExplicitImports Inventor.LevelOfDetailEnumSub MainiLogicVb.UpdateWhenDone = TrueDim doc As AssemblyDocumentDim oLOD As LevelOfDetailRepresentationDim oAsmCompDef As ComponentDefinitionDim oComp As ComponentOccurrenceDim oComps As ComponentOccurrencesdoc = ThisDoc.DocumentIf. [code]....
I am trying to make port rims for pipes that can be swapped in and out of an assembly. However, the ports will all be different sizes and located differently so I need the cut to be part of the port rim component, but affect the entire assembly it is part of. I've been trying to get this to work for the better part of a day now,Here's a picture of what im talking about. I'm running Inventor 2008 by the way.
I have a iLogic question about finding out if a View exits..
Lets say I have a drawing that I want to read the scale of a view.. All the snippets I have found is pointing to the name of the view like "VIEW1". But if I have deleted the first view I created it will give me an error..
So, is there ant possibility to check if the "VIEW1" exits without getting an error?
I'm trying to copy sheets from one dwg file to another in Inventor 2010. I get the error: "Named segment already exists: cannot create or rename". The sheet name is not listed in the target file. Why this error is occurring and how to fix it?
I have a drawing of a sheet metal part with multiple sheets. I have named each sheet to reflect the nature of the views (general dimensions, detail views, flat pattern, etc.). I want the name of the sheet to appear in the title block, but I cannot seem to find the "Sheet Name" property anywhere. Can it be added to the list of the drawing or sheet properties, or is there another way to achieve this?. I do not want to have to use Custom Properties, and manually re-enter the names of each sheet.
I am trying to write a small standalone app in C# that I can run when I have an assembly document open. I want the app to iterate through all the parts in the assembly and set the iproperties. I am having some trouble accessing the iproperties however.
I want (for example) to set the "TITLE" in the "DOCUMENT SUMMARY INFORMATION" to be a concatenation of the part number and the description separated by a " - ".how to access these properties.
I'm looking for a way to convert the iproperty value "volume" into length from known values in the part. I have an assembly which consists of 20 different typs of sheets which are rolled out in certain patterns. The width and depth of the sheet are known, and I would like to use the volume to find the length. The assembly is linked to an excel file so the values will change based on certain parameters. I'm using this as a check to make sure there is no error from the spreadsheet.
I'd like to build a rule into my standard part template that takes the part number (which it automatically gets from the file name by default), removes the characters after a delimiter, as well as the delimiter itself, and sets that as a new custom property. For example, we'll call the custom property Prop1
For part 123-321-1.ipt
Inventor already sets part number iProperty to 123-321-1
I want to set Prop1 to 123-321
For part 123-321-25.ipt
Inventor already sets part number iProperty to 123-321-25
I've created a form to fill out with drop down options that link to a multitext parameter. I want to link this parameter to the keyword iproperty but a text parameter will not export.
My company manufacturs many sheet metal parts that ends up being painted.We need to describe both material and surface treatment in the title blocks on our idw's. Inventor parts then have a selected material (the required steel type) and a color override is applied (the required paint job) But color override is not just like that to retrieve for the title block, like standard iproperties like
I know how to get a parameter into my list of custom iProperties.What I want to do is take the iProperty lbmass and add it to the list of user parameters. Is there any way to do this without using iLogic?
I am trying to change the iProperties "Physical" "Material" using an Inventor VBA macro..For example, say the material is set to "DEFAULT" and I want to change it to "TITANUIM", how can I do this using VBA?
I have a template part that I would like to save automatically once the parameters dialog box is closed. I would also like the Save As filename to automatically be filled in with a iProperty named "Part Name". I already have the "Part Name" description grabbing information from parameters. Is this possible? And is the best way to trigger the event after an "iProperty change" or "Any Model Parameter Change"?
is there way to refresh sheet of drawing when an iProperty is changed trough API? When I change for example revision Number, the sheet still show old number. The value is changed, because if I open the iProperty dialog, there is new value and also when iProperty dialog is close then the sheet (title block with this property) is immediately correctly updated. I know that I can use ActiveSheet.Update method, but this update whole sheet and it take long time. There nust be something better because dialog iProperty doesnot update whole sheet and it is vvery quick.
Dim oISI As Inventor.PropertySetDim oDrw As Inventor.DrawingDocumentSet oDrw = ThisApplication.ActiveDocumentSet oISI = oDrw.PropertySets.Item("Inventor Summary Information")oISI.Item("Revision Number").Value = "test"oDrw.ActiveSheet.Update ' I would like to replace this line, this take long time