AutoCAD Inventor :: Change Drawing Scale With ILogic Upon Parameter Change
Jul 8, 2013
I have a spreadsheet and iLogic driven mater assy to generate different iterations.
I would like to change the scale of a base view on a drawing based on a parameter in my assembly. The idea is to get iLogic to change the view using a simple If / Else statement.
This is what I tried:
If Parameter("0 Generic Assembly v2.2.iam.BP") < 1570 Then
ActiveSheet.View("VIEW1").Scale = 1/8
Else
ActiveSheet.View("VIEW1").Scale = 1/10
EndIf
So basically the value of "BP" parameter (excel parameter in my assy) would drive the scale of the views. But its not working. Is it actually a sensible method? Can I use in the drawing environment the excel parameters in my assembly?
This is the error message I get when the rule is run:
"Error in rule: View Scale, in document: 0 Generic Assembly v2.2.idw
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))"
Also using the same thinking I use iLogic to populate the drg number field on the drawing based on an excel parameter. The rule works but does not always updates the drawing no upon the parameter change or update/rebuild commands.
The commented code does not work. I want to be able to open a part and change its size parameters before i open the assembly. this code will run as an external rule in a new empty file.
If i can do it without opening the part, that is even better. Test can I open a part, change a param, then close part.
Dim fname As String fname ="C:Workspacemy_progchanF_BB_L.ipt" Dim pDoc as PartDocument = ThisApplication.Documents.Open(fname,False) pDoc = ThisApplication.Documents.Open(fname)
These are just attempts to find a syntax that works. I need the method to change the parameter.
I have a users who cannot change parameter values for iLogic unless user is a local admin on the workstation. This machine has just been upgrade to Inventor 2013.
I have a flange that I use iLogic and the parameters list to update the different styles. My problem is that my flange won't update until after I hit save and update. My other square flange is not this way. As soon as I change the parameter in my square flange it immediately updates. Is there anyway I can get my round flange to update immediately like my square flange? I attached pictures below.
I`m looking for the iLogic code that can change one parameter (user defined) for each (ipt) part in assembly (iam)
The one below doesn`t work.
Sub Main Dim oApp As Inventor.Application = ThisApplication Dim oAssy As Inventor.AssemblyDocument = oApp.ActiveDocument For Each oSubDoc as Inventor.Document In oAssy.AllReferencedDocuments On Error Resume Next Parameter(oSubDoc, "FH") = 15.26 Next End Sub
I want to be able to change the header on a PL in a drawing using iLogic.
I'm able to "find" the PL(s) on a drawing but can't seem to figure out how to access the header property My goal to to change the header to show the P/N of the assembly/part it's created from.
My Current code is below:
doc=ThisDrawing.Document oBOMs=doc.DrawingBOMs
For Each oBOM In oBOMs MessageBox.Show("Found a PL", "Title") Next oBom
In between the for/next loop is where I want to access the current BOM and change it's header depending on the related .iam/.ipt.
Im looking to make a simple ilogic rule that can toggle an option in the document settings, the setting I would like to change is the Document settings> Modeling> Participate in assembly and drawing sections
I would like a form to switch the option on and off quickly, its a really usefull function however I know a few of my colleagues wont use if they cant find it easly.
I am trying to have one drawing with B size and E size sheets I am trying to get the border, title block and standard to change when the sheet format changes. I can get it to work when I run the rule but have hard time find information to just change when sheet format changes. And I can't find anything or I should say a sample of how to. I think I found the code just don't know how to make it work. Here is what I have so far.
I am trying to piece together some code for an ilogic rule. This rule should look for a drawing view that is a flat pattern, if it finds one it should change the object layer to our "CNC" layer.
I am currently working with fx parameters and iLogic to drive a model and it's corresponding drawing to change based on a single user parameter.
I have managed to get the drawing to update both the scale of the views I need and the size of the sheet with the change in parameter using the following rule:
However when i attempt to use this with the title block using the function:
ActiveSheet.TitleBlock="My Title Block" in place of the sheet change size it brings up the error message:
Error in rule: Drawing Title Block, in document: Drawing
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
I have read elsewhere that this is due to me having prompted entries for the scale and drawn by fields, however when i use the function designed for prompted entries: ActiveSheet.SetTitleBlock("Other Title Block", "promptedEntry1", "promptedEntry2") It fills in the prompted entry fields from the code and if i change these entries in the "edit field" option they are overwritten when it is updated.
Is there a way have the prompted entries when you open the drawing fill in the "promptedEntry1" field in the rule so that I can use the rule? Or am I going about it the wrong way?
I should point out i'm new to iLogic and no-one in my workplace can use it so each person changing the "promptedEntry1" field to the scale they wish isn't a wise move.
I was looking to change the fonts in a drawing for the Dimensions and Symbols that might have been inserted in the Dimension text entries.
This can be done manually bu editing the dimentions text after placemement, but I was ooking to set this as a default.. I cannot see where exactly this is controlled in the Styles Manager - I am only able to change the Dimension text font but the diameter symbol font is always on AIGDT.
I was therefore looking for an iLogicvb code that could do the trick, but I am not able to even change the dimension fonts... The code runs with no errors but nothing gets updated in the drawing...
Dim oDoc As DrawingDocument oDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet oSheet = oDoc.ActiveSheet
How to change the color of layer that will be used within a drawing files for special purposes.
Ideally the code will make the color Red, but change to Black prior to printing.
The "logic" behind the code currently is to differentiate a layer called "Burn" to a highly visible color for the purpose of review by others then, prior to printing, change the color to Black. The firm I'm currently working for uses gray-scale B sided printers only. The firm currently uses Blue for dimension and extension lines so to produce drawings that portray both type of objects "lightly".
I am trying to publish to the CC a guide rail. The vendor of the rail gives me the option of entering the desired length of the rail. After that he gives me the option to choose between the length that I entered and a shorter and longer standard length witch can be delivered faster.
I want to do the same thing with my published part, but I cannot make a key parameter to change depending on the entered custom parameter. I want the user to make the next steps when inserting from the CC: 1- select the size of the rail; 2-select the type of the rail; 3- enter the desired length of the rail; 4- choose between the desired length and the 2 recommended lengths (I need these 3 lengths to be shown)
I realize it may be a Civil3D question. When I change my drawing scale in the "Drawing Settings" dialog box to 1"=40', for example. The Annotative scale in the Properties Palette changes to 1"=40'_XREF.
I'm trying to put together some iLogic code to either check all the drawing views within a drawing sheet are all the same scale, or make the views all the same scale. These drawing sheets consist of a number of individual parts (they aren't projected views from a single part).
This is for welded assemblies. We are required to generate a profile drawing sheet outlining each part that makes up the assembly. We send these out as dwg files for laser cutting so its important that the views are all the same scale.
I have a piece of equipment that changes from 24" to 96" with 5 discrete sizes. I am using ilogic to make all the changes required to the part. Any way that I can change the scale of a drawing using iLogic so that it fits better on my drawing and be adjusted every time. I have multiple pages that most of the drawing views need to be changed every time.
I have generated frame that has 100 members in it. Is there a quicker way of changing G_L unit to a mm so that I don't have to go into all 100 parts to change the custom properties?
Also I do not need unit string to be appear in my BOM.
I have a fully completed drawing that is in 'architectural' (inches) and I would like to be able to change all of the 'feet & inches' linear dimensions (which form part of the drawing when the layer is turned on) to solely 'mm' instead.
The UNITS command keeps coming to mind, but I know that's not how to go about it. I've Googled for like 45 mins and read some highly overcomplicated instructions that lost me.
(note I am posting this in the beginners section )
simplified way to change this either via a command or changing settings via the toolbar?
this code works for parts. But how to change it that it works for assembly? I would like to select a part and than change the value.
m_invApp = GetObject(, "Inventor.Application") ' Get the Parameters object. Assumes a part or assembly document is active. Dim oParameters As Parameters oParameters = m_invApp.ActiveDocument.ComponentDefinition.Parameters [code]........
How can I change size of the content center part in an assembly based on parameters using iLogic.
There is also the possibility that I would need to replace from content center. I have been unsuccessful in adapting previous examples to work as I need. attached is an example of a part I am tryig to change with parameters and the start of some iLogic. I am using inventor 2012.
Mleader arrow head didn't change size when change the scale on Object property?
The Arrow head size didn't change corresponding to the scale, i included the pic below, the top picture, the arrow head was set at .18" but was really small when i plot out, so i wanted to make it bigger, when i changed to .50" or .75" or even 1" the arrow head became even smaller than .18". Only when .18" than the arrow side is legible
I've seen snipppets of code to get the Sheet name but is there a way to set it via code? I'm thinking it might be useful to set the sheet names to the chosen sheet format (as opposed to just 'Sheet').
I'm sprucing up my drawing template...
Rule #1 is for selecting sheet format (which title block/sheet size / orientation) Rule #2 is for setting iproperty values to populate the titleblock with info. (if required) Rule #1 was based on code from S.Bixler & inventortrenches Rule#2 was based on more code taken from here.
Issue between an i-assembly and i-Logic. So, I have an assembly that includes some extra components that are not always needed and therefore an i-Logic rule takes the decision whether these will be suppressed or not.
Of course this is not a problem however it turns out that I miss some info from BOM according to the suppressed parts ...and all these makes sense following the LOD etc.
A potential solution to keep up to date the BOM while you are excluding the needless components is to create an i-Assembly.
To keep that simple I turned my current Assembly to an i-Assembly and very successfully I excluded various components and of course I included some others by adding extra ROWS.
So far So good
Now I want to apply some dimensional boundaries by using i-Logic rules. According to them I want to allow this i-assembly to jump among these different ROWS that meet the right criteria.
Very rough thoughts led me to the following code...
For example...
If Width > 600 Then iPart.ChangeROW ("..." , "...") 'Row-1' Else iPart.ChangeROW ("..." , "...") 'Row-2' End if
The Problem is that the above code works fine, for a example, in case that I will place an i-part in my assembly... However I am looking to change the row of the actual assembly that as I mentioned before I turned it to an i-assembly
To make this even more clear I want to be able to manipulate my i-assembly with i-Logic rules while this is open in Inv. I don't want to change rows while this is placed as a component or sub-assembly in an another assembly...
I am using Inventor 2012: I have a table with different part numbers. I want to create an iLogic rule to change the color of second solid body in my part for a specific part number.
This is what I did.
If iProperties.Value("Project", "Part Number") = "F22111796" Then Feature.Color("plastic")= "Gray" ElseIf iProperties.Value("Project", "Part Number") = "F22111796V" Then Feature.Color("plastic")= "Gray (Dark)" ElseIf iProperties.Value("Project", "Part Number") = "F22111796N" Then Feature.Color("plastic")= "Gray (Light)" Else Feature.Color("plastic")="Gray" End If
However it does not change the color of the second solid body when I make the part number active.
I have a sheet metal part that I converted into an iPart and I set up different rows with different sheet metal styles. What I want to do is run an iLogic code to change to a specific row which in turn would change the actual material of that sheet metal part....I've tried the snippet iPart.ChangeRow but cannot get it to run the code. I'm not sure if I'm not doing something right or what...