AutoCAD Inventor :: Creating Macro To Run From Assembly That Will Loop Through Each BOM Item
Sep 28, 2012
I'd like to create a macro that I can run from within an assembly that will loop through each BOM item and add the quantity req'd to a custom property within the component. I'm very familiar with VBA from Office, but I'm new to it with respect to Inventor so I'm pretty fuzzy with object titles and options.
Here's an outline of what I'd like to do:
Execute Macro from within Assembly file
For Each BOM Item to # of BOM Items
If Vendor = "Make" then
Set Component Custom Property "Qty_Reqd" = Total Qty from BOM
Endif
I have a drawing in which I need to keep a part in the assembly but I don't want to display it on the BoM. Is there any way I can remove it from the BoM without removing it from the assembly and drawing?
I'd like to use the Cable and Wiring tools to model some fibre optics. I can see how this could work well, being able to set and check for the minimum bend radius. However, I'd also like to include a loop of greater than minimum bend radius between the two connection points, we tend to do this to reduce strain on the fibres. Any elegant solution for inserting the loop?
Is it possible to make the column 'REV' automatically equal to the 'Item' column in attached BOM view? I manually added the values 1 to 5 in the REV column for example.
Maybe with some ilogic rule? I don't know if it's possible and/or where to start.
When i place a mono-part-detail on a assembly drawing i want to be able to place a leader referenced to the REV value. When this is possible there is a link between assembly item number and the mono-part leader.
I don't know how useful this will be but I was trying to figure out how to track what item number in an assembly any given part may be. I was thinking that on an individual part drawing I may want to reference the item number that is used in an assembly's Bill of Material for that part. I can't find where this may be stored for retrieval. If I do this I would want it to be automated so that if the BoM were renumbered the part file and drawing would update to the new item number.
This may not be possible since any part may be used in any number of different assemblies with different locations in a Bill of Material. Most of our assemblies use "one off" parts that are only used in that assembly so it may be possible in my particular situation to do this if there is a way to get at the BoM item number and connect it to the IPT file.
I have made a macro that asks for a location on the file server (=client name) and then the project name. It then automatic creates the correct folders, opens my custom assembly template and changes an ipart that is by default in it.
That's all great and can save us a ton of time, but the last step is to automatic save the assembly! I just can't get it working and can't find the correct code.
I have defined the target folder earlier and the file name of the assembly is identical to this folder. For example
the code that I think should work looks like this:
Sub SaveAssembly() Dim oAssDoc As AssemblyDocument Set oAssDoc = ThisApplication.ActiveDocument oAssDoc.SaveAs ("O:ProjectsclientNameClientProject1ClientProject1.iam", False)End Sub
But it doesn't work, I always get the error message "Compile error: Expected: =" Whatever I do next I don't get the code to work
I have been working with macros basically making user forms to control the models. The program calls on a part that I use as an actuation template (its just a part with parameters that are then linked to the assembly contraints) then the macro will change the parameters and update the model.
What I need to do is to put in some code in the userforn initialize sub that gets the actuation template from the disk, for example: C:Other StuffActuation Template A.ipt. Then the macro places the part into the assembly. The userform then manipulates the actuation template (and the assembly model). Then when the userform is unloaded the part is deleted from the assembly.
I'm looking for the best way to create a separate assembly out of various component parts in an existing assembly so that the whole thing can be placed in an assembly as you would a part, I know it's possible to demote components within an assembly but are there any other methods similar / better ?
I have been trying to create a macro to control an assembly. The problem is that I need to access a certain parameter in a specific part in the assembly. I can get the exact parameter by using the "name" of the given parameter, ex .Item("d7") to call the parameter d7. The problem for me has been what name do I use to call out a given part, I have been using .Item(Index number), ex .Item(12), but this number can change as parts are added, deleted, or suppressed.
The question is what "name" should I be using and how do I use it. I have tried
Simple question: How do you add a WorkPoint in an Assembly? I was hoping to find something like:
dim pt as new point ( 0, 0, 1) oPartDef1.workpoints.add(pt) ~OR~ dim pt as point pt.setlocation(0,0,1) oPartDef1.workpoints.add(pt) [code]....
It seems like I need to make a geometry (i.e. thisApplicaiton.TransientGeometry.CreatePoint(0,0,0) ) but I cannot find this feature for a component Occurence. I don't want to make a "Global" point, I want to make a point "Local" to a particualar part.
I am wanting to create an assembly that I can manipulate and `pull about'.
To describe what I have and I want to acheive try and picture this very simplistic layout :-
A length of hose 50 meters long.
Another length of 50m long hose 2 meters directly below it.
The 2 lengths of hose rigidly tied together at 2m intervals with a small diameter solid bar and clamps around the hose.
What I need to acheive is :-
An assembly showing the above items in a long straight 50m run.
(I have no problems with creating this assembly.)
From there though I then need to be able to create an `S' shape, with the hose staying at a fixed radius where it is rolled to form that shape, both hoses must stay inline with each other at all times.
If you can imagine how a hose would react as you rolled it in reality I want to try and replicate that within my assembly if it is possible?
I realise I could create one long flat assembly then create another seperate assembly showing it in it's rolled up `S' shaped state but that is not what I am wanting.
I am facing problem in creating part in top down assly.
Find attachment.
I first part as pipe having dim 300 mm.In assly I select create option and made sketch having diameter 100 circle . I have extrude this circle up to the wall of 1 st component . I select to option but surface of 1 st component not getting selected. If I select 1 st part rectangular shape, that case 2 part extrude using same concept. (# ref 2 attachment)
i am trying to create a part within an assembly to make sure it fits around a curved column. Please see my short video.
I can create the sketch on a plane and it will s how the potential extrusion however, it wont extrude.
This happens under any condition. I have tried different shapes and everything but i get the same thing. How to successfully create parts in the assembly and save the m out as part of the project?
I wonder if there is any way of creating the list of drawings that derive from a general assembly, which contains sub assemblies and spare parts. That involves to export some personalized i properties, such as nº of drawing, nº of father drawing (for sub-assemblies), and title.
The idea is creating a inculcated link between these drawings (.idw files) and an excel file that, if possible, updates itself when changing the drawings.
I am trying to create a step file of an assembly, the assembly consists of maybe 50-100 parts. I am currently running Inventor 2009. In a new part file, I derive the assembly to make it one solid entity. Then I save that as a step file. However when i open the step file, i have a bunch of extra "parts" in my model tree. These parts seem to be where the bolts and threaded holes interfere or not all parts joined to the main solid model. How can I eliminate this?
Also on a side note, is there anyway to change the orientation of the WCS?
Long time Autocad user but now am moving most of my work across to Autodesk Inventor.
Some of the work I do is with companies that their parts are standard components that will not change.
So I am using Inventor to automate the drawings based on their requirements. For example if it needs to be 4m high. then to use 2 x 2m sections. Currently I have create different assemblies of the different potential heights that I can switch between using ilogic but I need to be able to shift the top truss arch depending on how high the truss is.
I am building a consumer electronics prototype that has mechanical and electronic components. I have built the assembly I need at the dimensions and measurements required. I am having trouble finding tutorials or instructions on how to derive a shell or frame from the complex inner components of an assembly. What is the general approach I should take, I'll get to the details. So far I've tried a loft that goes through the areas that have very specific measurements.
Usually what I do is download a 3D CAD part from McMaster Carr or some other place and start from scratch trying to recreate the part or, in this case, the assembly. I'm working on modeling a simple swing-arm type of machine I've made in the past and the I've been able to recreate all of the parts with their proper ranges of motion except one. It's an Inline Ball Joint Linkage that has a rubber boot around it to keep the dust out and possibly grease in. I want to know if it is possible to model the rubber boot so that it would mimic real life movement. Right now, the boot is basically a rigid cylinder and as the linkage swivels, the solid bodies clip through each other.
I've been able to make a flexible hose type of assembly as shown here: [URL]... However, creating a 3D drawing with a spline that attaches to work points on the other assemblies causes the Ball Joint to no longer work. It will only rotate as opposed to swiveling.
My issue is we have Universal assemblies that never change. These assemblies are thousands of parts. (hardware gaskets other random assemblies.) this top level universal assembly never changes.
to increase time in layouts. we would like to create these universal assemblies into 1 sold part.
Is there a was to export an assembly into a single solid part.
I have this assembly which includes a weldment and a derived / mirrored part where i need to identify the COG for lifting with a crane.
As you can see in the image (most components not visible), the COG is way off. The left half is the weldment, the right is the derived/mirrored part. Is there a way to get an accurate COG from Inventor 2010 short of creating a RH assembly instead of deriving the part?
I am trying to create a closed loop alignment for a track. Previously i have included a small gap between two alignments to get around the problem when a housing plot is created (see the attached dicument) when a closed alignment is created, Is there any way of getting rid of this?
So I created the rail sub assembly everything looks great in sub assembly composer.
Start a new dwg data reference in the rail alignment, Note the rail alignment type is set to rail.
Create an assembly and under the Construction tab for the assembly the Assembly Type is set to Railway. Attach my custom sub assembly to this assembly.
Created a corridor and I get this error: Something wrong with current subassembly: Operation is not valid due to the current state of the object.
So I delete my sub assembly attach the Civil 3D Rail Single sub assembly. Re run corridor and everything works fine.
So I promote the alignment change type to centerline. Delete the Rail Single sub assembly put my rail sub assembly back. Rerun the corridor and everything works.
So then I undo everything up to the point of promoting the alignment.
Opened the base file changed the alignment type to centerline.
When I tried to synchronize the references I ended up a broken reference with the following error. Invalid reference. Synchronization failed
Not good we already have plan sheets cut.
where in sub assembly composer were do I define the sub assembly to be for Rail?