Thursday, October 17, 2013

Placing decals on inventor parts

I am going to demo the fuselage and putting the decal on it.  The fuselage part file was donated by Tatyana Uzunova (see end of post for more information on the model) for use in this post.  
First, we are going to create a couple of work planes as shown below:
Start the plane command and then pick the XY plane from the origin folder.  Offset the new plane 50mm from the XY plane.


Start a new sketch on the plane you just created.  And place the image file in the sketch.  You will have to scale it to cover the area that you are wanting it to and move it around until it is in the right spot.

Next, you will want to pick on the picture and the right click and in the pop up menu select the properties.  In the properties box you will want to check the box that says “Use Mask”.  This will remove all the white backing of the picture.  Something I found while doing this the .png image files look better when done with the decal. 

Once you check the “Use Mask” box then click okay, and then exit out of the sketch.  Next, you need to find the decal button on your ribbon panel (I am using 2013 Inventor; can’t remember if 2012 is all that different in setup).  See pic below.  Pick on the decal button.

Then when the decal dialog box is up; pick the image for the decal and then pick one of the faces on the side of the fuselage.  Make sure that the “Chain Faces” box is checked.
Pick okay
And now you are done with that decal.



Max Bee" is control line model, designed by Igor Burger from Slovakia. 
The model is born 2010 as idea - conception and realized 2011.
Participate in class F2B aerobatic model. In that class competitors must fly pattern of 16 figures start from take off and landing.
Construction of the model is made from foam and balsa / the most light material of wood in world /. Inside has a power train and system mechanism collecting wings, flaps, stabilizer, rudder and fuselage. Lines of model are with length 21 metra with thickness 0.48. The model works with electric engine 2628 Axi.
The model and pilot become 
3 times EU champion and World champion of 2012. 
Color scheme of model and 3D realized by Tatyana Uzunova

Friday, September 6, 2013

Titleblock with attribute fields linked to drawing properties for Autocad

So, this is going to be a quick instructional post on how to link a title block to custom drawing properties in AutoCAD.
First you need to start a new drawing file.
Then pick on the logo to pull down what you see below.
hover over the "drawing utilities" and then pick on "drawing properties"

When the drawing properties dialog comes up; pick on the "Custom" tab and then pick on the "Add" button (as seen below).


Create whatever kind of name you want for a custom property; in mine I am creating one called Client.

now, you have done this in the drawing; you will also want to duplicate this in the titleblock drawing file.
that way when you go to insert it into a drawing it, but we will cover more of the titleblock setup soon.
Once you have done this you are done with this new drawing file for a minute.
Open up your titleblock file, and go through and create the custom property as you did in the other drawing file.  Be sure that the property name is identical in both files.  
Now that you have created the custom property, you can set up an attribute to reference this new custom property that you set up.  Here is how we are going to do that.
Double pick on the attribute that you are wanting to change or create a new attribute; in this case I have a multi-line attribute that is easy to change.  Next, we will pick on the button to the right of the default box to open up the text editor

Select the line of text that you are wanting to have linked to the custom property, and then pick on the add field button on the far left of the "text formatting" bar.

The below dialog will show, and as you can see in the field names column you can see the custom property that I created, so we will select it and on the right column we will select uppercase so that no matter how i type it in it will always come in as uppercase letters.

Now, once you do that hit the "ok" buttons until you are out of the attribute editing and then save your titleblock.
With this being done; go into the other drawing file and change to the layout1 tab, and insert the titleblock.


Once you have done this save this drawing file as a template that way everything will automatically be setup for you each time you start a new drawing.

This can be done with lots of custom properties in the title blocks.  I have a title block that probably contains 10-15 linked properties.
And anytime that you change a property value; all you have to do is either regenall or do the updatefield command.


Diesel Macro study guide...

I am posting this one out there for those of you that use Diesel macros, but don't quite understand how to program them.  The link below will take you to an incredible pdf that you can learn a lot from for creating Diesel macros.  I definitely learned a lot and it will help to get your creative thinking going on different stuff that you can do with the macros.

http://www.cadcentar.com/DIESEL.pdf

Hope that it helps you out!

Wednesday, August 28, 2013

New Translation Tool!

To all viewers of this blog; I have added a tool to translate this blog to many different languages.  I want any and all to be able to read and understand the topics that are being discussed on this blog, so I hope that this helps and makes it a little easier for you to be able to read my blog.

Remember, if there is any questions that you have about AutoCAD or anything else drafting related please post questions or if you need something clarified in any of the other posts please post a comment and let me know what you are needing help with.

Thank you!

Breakdown of the Macro for the Attributed block...

So, I gave you the macro for the attributed block but didn't break it down and show how it works.
Well, I am going to remedy that with this post, so this is for you Designers out there that are learning Diesel Macros for AutoCad LT.

*^c^cattdia;0;_.insert;station2;\;1;\;;setvar;userr1;$m=$(+,$(getvar,userr1),$(getvar,userr2));setvar;userr3;$m=$(+,$(getvar,userr3),$(getvar,userr4));
Notice what the text that I have made bold and italicized in the code above;  remember I said that this command will repeat until you hit escape.  That is due to the asterisk that is at the beginning of the code.  If you don't want the command to repeat then remove the asterisk.  (FYI: If you are wanting to insert a block and have it explode after insertion then place an asterisk at the beginning of the block name.)

*^c^cattdia;0;_.insert;station2;\;1;\;;setvar;userr1;$m=$(+,$(getvar,userr1),$(getvar,userr2));setvar;userr3;$m=$(+,$(getvar,userr3),$(getvar,userr4));
Now in this grouping we are telling Autocad to turn off the attribute dialog box when inserting the block and put the attributes through the command line.  This is done by the "attdia;0;".  On to inserting the block; notice the there is an underscore and a period before the insert command and this is so that the command is more versatile between versions and even languages.  After the command we call out the name of the block; then the first "\" is to call for user input for the insertion point.  The "1" is to tell it the scale for "xy", and then the next "\" is for user input on the rotation of the block.  Now notice the last two semicolons in this grouping remember we changed it to where the attributes would be defined through the command line; those semicolons are entering through the attributes because they are being driven by the diesel expression built into them.

*^c^cattdia;0;_.insert;station2;\;1;\;;setvar;userr1;$m=$(+,$(getvar,userr1),$(getvar,userr2));setvar;userr3;$m=$(+,$(getvar,userr3),$(getvar,userr4));
Now to the fun part of the code, the Diesel Expressions!  We start off by telling Autocad that we are going to set the variable or userr1; and then the "$m" is telling autocad that we are going to pass it a diesel expression. (This is one of the odd things of Diesel Expression; the use of dollar signs in front of everything)
To start we are telling autocad that we are wanting to do an addition function where we are taking userr1 and adding userr2's variable to it.

*^c^cattdia;0;_.insert;station2;\;1;\;;setvar;userr1;$m=$(+,$(getvar,userr1),$(getvar,userr2));setvar;userr3;$m=$(+,$(getvar,userr3),$(getvar,userr4));
So, this set is setup the exact same way as the previous grouping the only difference is that we are defining userr3 and then telling it to add userr4 to it.

Hope this helps to more understand the functionality of the code and maybe help out with your understanding of how diesel expressions are created.

Tuesday, August 27, 2013

Diesel Expression in Attribute Fields

Okay, so this is my answer to a question that I saw on cadtutor.net, and I thought that it would be a good topic for a post because I am sure that there are others out there that could use this or something similar to this.  So, today we are going to set up an automated block to increment station number and the elevation of that station.  We are going to do this by setting up a couple of attributes with built in diesel expressions.  
The first attribute is going to be our station number, so (as in the picture below) fire up the attribute definition and in the "Tag" field enter in Station; and then in the default pick the field button to the right of the text box, and then follow the pictures below.

once you are to the "Other" category; we are going to pick on the "DieselExpression" field name, and then enter the diesel expression seen in the picture in the field box.

Once you finish that pick okay, and then make sure the rest of the options are to your liking for the attribute definition and then go ahead and pick okay to place the attribute on your drawing.  Next we will repeat the process for the elevation attribute.
Notice that in this diesel expression field that the "userr" variable is different from the station number variable.  Make sure that you do this or you might have some confusion in the program when trying to place the block.


The picture below is what the (2) attributes should look like when you are done.  Now, once you have this we are going to select the attributes and then run the "Wblock" command.  When you pick the basepoint, pick the bottom left of the elevation attribute.

Now, that we are finished with establishing the block let's get on with the macro.  This macro is set up for LT users, but works no matter which Autocad you have.  If you notice, I named my block "station2" you can name it whatever you want just make sure that you change the name in the macro as well.

*^c^cattdia;0;_.insert;station2;\;1;\;;setvar;userr1;$m=$(+,$(getvar,userr1),$(getvar,userr2));setvar;userr3;$m=$(+,$(getvar,userr3),$(getvar,userr4));

Once you have assigned the macro to a new command button and get it placed on a toolbar or ribbon; you are set to insert your new expressive block...wait a minute...there is one more thing that has to be set up before you can run away with it.  When you are in the drawing that the block is going to be placed in, and before you run the command.  You need to go through and define the variables in your "userr1", which is your starting station number; "userr2", which is the increment that your station number will increase by each time you place the block; "userr3", this is your starting elevation; and last but not least "userr4", and this will be the value that your elevation is going to increase by each time you place the block.

Okay that is it...have fun placing blocks!

Sunday, August 25, 2013

New Commands/Variables for AutoCAD LT 2014

Here is some good news for you LT users out there.  With the newest release comes some new system variables and new commands available to The LT users.  See the link below for a complete list of the newest additions.

LT is still AutoCAD: AutoCAD LT2014 New Commands/Variables

Friday, August 23, 2013

ThreadModeler App. for Autodesk Inventor

I don't know how many of you have used the app exchange that is available for a lot of Autodesk Products, but there are some great tools in there for designers.  Today I am going to highlight one of the tools and the app is called ThreadModeler.  This is an awesome tool for you Inventor animators out there especially if you use publisher.  When using the ThreadModeler app you can take a bolt that has an image of threads and it will actually cut out the threads for the bolt so you have an actual representation of the threading.
let's start with where to find it
With Inventor launched you will go to the "Tool" panel on your ribbon bar and then select the exchange app manager.

Once you have the website launched you can find the threadmodeler app 1 of 2 ways; either off to the right side of the page there is a "most downloaded" panel and typically it should be on there.  If you can not find it on there then go to the search bar and type in threadmodeler into the search bar.

Once you find it and get direct to the page to download it you will just have to pic whether you have win 32/64 and the language and then click on the free button to download it.
Once downloaded; close down Inventor and run the installation.  When the installation is done launch Inventor again.
To test it out start a new part with a cylinder; for mine I created a 1/2" diameter cylinder at 2" long and added the thread feature to the cylinder.

Go to the "Tools" panel again and there you will find the Thread Modeler button.  Pick the button to run the command and then pick the thread feature from the browser bar (can't pick the actual part).
The program inputs the information it needs and all that is left is for you to click the "OK" button for it to do its thing.  Below is my finished product.
 Like I said before; this would be a great app for those of you out there that do a lot of animations for product construction.  It would give a great visual for the customer to see the bolt actually turning in animation.

Thursday, August 22, 2013

New Collaboration tool from Autodesk!

Autodesk Fusion 360 is the newest collaboration tool from Autodesk.  It allows for all members of a project to collaborate together no matter where you are.  Each person can mark their own comments on parts and assemblies all while the design is doing his/her thing.  I can see this being a great tool for prototype shops and for think tanks.  See the link below for a video that shows the flexibility of this new product.

https://www.youtube.com/watch?v=8760W4PIob0

Thursday, August 15, 2013

Diesel Macro Letter Automation...broken down

I realized that i had posted the diesel macro for letter automation, but didn't really go into the breakdown of the functionality of the macro.  So, here is my attempt at breaking it down...first let's look at the macro that was written again.

*^C^C_text;\;$m=$(if, $(<=,$(getvar,userr1),7),$(nth,$(getvar,userr1), A, B, C, D, E, F, G, H),$(if,$(>=,$(getvar,userr1),8),$(nth,$(getvar,userr3), I, J, K, L, M, N, O, P)),)$(if,$(>=,$(getvar,userr1),15),$(nth,$(getvar,userr4), Q, R, S, T, U, V, W, X),)$(if,$(>=,$(getvar,userr1),23),$(nth,$(getvar,userr5), Y, Z, AA, AB, AC, AD, AE, AF),);setvar;userr1;$M=$(+,$(getvar,USERR1),$(getvar,USERR2));setvar;userr3;
$M=$(+,$(getvar,USERR3),$(getvar,USERR2));
userr4;$M=$(+,$(getvar,USERR4),$(getvar,USERR2));
userr5;$M=$(+,$(getvar,USERR5),$(getvar,USERR2));
SETVAR;USERR3;\SETVAR;USERR4;\SETVAR;USERR5;\

First, we know that you start with the text command and go through all the prompts for it.  Then we work our way into the diesel portion of the macro...so, when developing this I found out that when using the "nth" function by itself you were limited to 7 arguments within the function.

Hence, why I embedded the "nth" function within multiple if statements.  
 Let's dissect these if statements a little:
 $m=$(if, $(<=,$(getvar,userr1),7),$(nth,$(getvar,userr1), A, B, C, D, E, F, G, H),$(if,$(>=,$(getvar,userr1),8),$(nth,$(getvar,userr3), I, J, K, L, M, N, O, P)),)

 so, in this first "if statement" I am telling it to evaluate the value of userr1.
$m=$(if, $(<=,$(getvar,userr1),7),$(nth,$(getvar,userr1), A, B, C, D, E, F, G, H),$(if,$(>=,$(getvar,userr1),8),$(nth,$(getvar,userr3), I, J, K, L, M, N, O, P)),)

 If a value of 7 or less is returned then it moves on to this nth function where i am again calling for the value of userr1.
 $m=$(if, $(<=,$(getvar,userr1),7),$(nth,$(getvar,userr1), A, B, C, D, E, F, G, H),$(if,$(>=,$(getvar,userr1),8),$(nth,$(getvar,userr3), I, J, K, L, M, N, O, P)),)

 you will find a recurring theme throughout these if statements that we are evaluating the value of userr1...here we are looking to see if the value of userr1 is greater than or equal to 8.
 $m=$(if, $(<=,$(getvar,userr1),7),$(nth,$(getvar,userr1), A, B, C, D, E, F, G, H),$(if,$(>=,$(getvar,userr1),8),$(nth,$(getvar,userr3), I, J, K, L, M, N, O, P)),)

 If it returns a value of 8 or greater then it will move on to the next nth statement where we call for the value of userr3.
 And this process repeats 2 more times with userr4, and userr5.  One thing that you should notice is that the value to be returned from userr1 increase by a value of 8 with each "if statement".
 Now that we are done with the if statements we can move  on to the easier portions of the macro...how the values of the userr variables increase with each repetition of the command.
 setvar;userr1;$M=$(+,$(getvar,USERR1),$(getvar,USERR2))
 This code will be repeated four times...you will just have to copy and paste and then replace userr1 with userr3, userr4 or userr5.
 And then the prompting for user input of the userr variables finishes out the macro.


 Hope that this helped to clarify the process of the macro.

Thought of the Day...(8/15/13)

If you are writing a lisp routine and you are trying to figure out if a command can be used in a lisp routine; try this...in the command line start by typing in a dash and then the command.  For example...if you are wanting to create a new layer.  In the command line type "-layer", then all the options show in the command line; Then just follow the prompts.
And at the end of it; if you are setting linetype, lineweight, color and the such...this is an example of what you will see...
-LAYER;NEW;D_EQ;LTYPE;CONTINUOUS;D_EQ;LWEIGHT;.020;D_EQ;COLOR;11;D_EQ;;

If you have "Dynamic Input" turned on then it is easy to see what commands you can use the "-" in front of.

Wednesday, August 14, 2013

Linking Dimensions in 2 Visible States on a Dynamic Block

I saw a question on a forum asking about making length dimensions on 2 different visible states equal each other.
For this example I am going to use an I beam block:
In the picture below you will see that the i beam is in a side view orientation.  Here we are wanting the dimension "Length_zaz"' to be able to control the length of the block in this visible state and in the top view which will be seen in the next image.   So, first in the parameters palette we will add a user parameter and call it length; and make the parameter link to our main length dimension.


Next we will change the visible state to the top view of the i-beam and then make its dimension link to the user parameter 'length' that we create.  Make sure that our main length dimension is visible in this state as well because this is what is going to allow us to adjust the length of the beam in either view.  Save the block and exit out of the block editor.


Now you can adjust the length of your beam in either visible state and it will translate to both visible states.
Hope this is helpful!

Friday, August 9, 2013

Revision Cloud in Inventor...

How many of you wish there was the ability to put a revision cloud on a change on a drawing in Inventor?  Me too.  I have been working with Inventor for a long time and didn't know this was available at all.  There is a way to install some usertools that will allow you to be able to create revision clouds on drawings.
Follow the steps below to install the tools:

First open a windows explorer page; and put the path below into the address bar.
C:\Users\Public\Documents\Autodesk\Inventor 2013\SDK
Once you are in that folder find the file that is called UserTools.msi; double pick on this file to run the installer.
be sure that Inventor is closed when you are doing this.
Once the installer is done...boot up Inventor and open a file.  Then go to the add-ins tab, and wallah...there you have the ability to create revision clouds.

Question for the piping designers out there

So, let's just say that curiosity is eating at me.  From the people that view this page; I am curious as to how many of you are piping designers?
And out of the piping designers out there; who uses SolidWorks as your primary design tool for piping assemblies?

I was presented a product yesterday that I had not heard of before, and it was a third party program that attaches to SolidWorks called Smap 3D.  After looking into it further and even downloading the free trial version (which I am looking forward to fiddling with later on).  I am curious how many of you out there have heard of this program and/or use it?

Please give some feedback on your experiences with it if you have any or what have you.


Thursday, August 8, 2013

Creating a SolidWorks Drawing template linked to custom properties

Okay…so, here is a post for the SolidWorks users out there.
I know recently at the company I work for and I have heard others ask this; the question for today is “How do you link a custom property in a part or assembly to a drawing file?”
I am going to demonstrate how to link a custom property from a part file into a drawing file.
  1. Let’s start of by starting a new part.
  2. Create a sketch on the front plane; and just create a box…don’t want anything fancy just a basic shape.
  3. Save the file to your desktop or wherever you know you will be able to find it.
  4. Then go into the properties manager and then click on the custom properties tab.
  5. And create all the custom properties you want. (fill in the values of some of them, so that we can make sure they work once we link them to the drawing file.)
  6. Save the part file
  7. Next we are going to start a new drawing, and when that comes up place a random view of your part that you created.
  8. Now, we get into the fun stuff.  Once the part view is placed; go in and select your sheet format and right click on it and pick edit sheet format. 
  9.  Now as shown in the Image 1; you will double pick on one of the textboxes that you are wanting to link to a custom property.  Then you will want to go to your side bar and pick on the ‘Link to Property’ button.
  10. In Image 2; pick the radio button labeled 'Model in View Specified in Sheet Properties'
  11. Then pulldown the listbox and pick the custom property you are wanting to link to.
  12. Lastly pick the okay button.
Now we are almost done...return back to the top level of your drawing file and go ahead and delete that part view.  Then you will save it out as a SolidWorks drawing template.
Now, go back to your part file and erase the feature that you created; then do a 'save as template' in your part file to create a part file template that already has your custom properties setup.

And now you have custom part and drawing templates.  The same can be down with assembly files as well.

Image 1
Image 2

Wednesday, August 7, 2013

Importing Page Setup from another drawing file (AutoCAD)

One of the things that I took on at the company that I am currently working with is build a bunch of macros that would make the design process easier.  So, the first one that I created was a macro that would insert the companies titleblock in a drawing, import a page setup that was defined in a different drawing, create all the layers required for a given discipline, create a new viewport, and then at the end would go through the edit attribute for the title block. 
Today, I want to take a look at how you can import a page setup from one file to another, and how to set a given page setup as your plot parameters.
So, below is an example of what the code would look like...
^c^c-psetupin;"D_SIZE-PID.DWG" "*";^c^c-plot;n;layout1;11x17;;n;y;n;


First, I want to point out just incase you don't know...at the beginning of each command you will see "^c^c" this is just telling the program to cancel out of any commands that it may be in at that point.
Next, we have the command "-psetupin"; and then the semicolon is issueing an enter command in the macro.
Then you will pass the macro the name of the drawing that you are wanting to get the page setup from and in my example I am calling out "D_size-pid.dwg" and you have to make sure that it is in the quotations.  Also, as long as the file location of the drawing is setup in your search paths then you don't have to worry about adding the whole location of the file just the nam will suffice.  The asterisk after the file name just tells it to select all the setups that are associated with that file.
Then, we move on to setting a specific pagesetup to our layout.  With this we begin with "-plot" which will do all the plot settings through your command line.  After starting the command the first question is asking if you want to do a "Detailed plot configuration"...we want to put "no". 
Then you will tell it which layout you want to apply the pagesetup to; mine is "layout1", and then type in the page setup that you are wanting to apply "11x17".  After the page setup name there are 2 semicolons; the first represents the issueing of an enter command, and the second of these represent a question that follows after the setup name...this is for the output device (printer name), and as long as that is set properly in your setup then you should just have to issue an enter command. 
Then it asks if you want to plot to file and for that we want to say "no" as well and it should default to that, but just incase we will put an "n"; and then it asks if we want to save changes to page setup, and for this you will enter a "yes". 
The last question is if you want to go ahead and plot and for mine a said "no".
Now, after all that you should end up with something like this...
-plot;n;layout1;11x17;;n;y;n;

Good luck and hope this helps!

Environment Variables within AutoCAD

When setting environment variables there are different ways of setting them depending on whether you are using full version AutoCAD or AutoCAD LT. To set an environment variable in AutoCAD you use the command...USERSx. X represents numbers 1-5. With AutoCAD LT you have to use...setenv. There are different environment variables when using this command. A couple of them are StrPrefix, and StrSuffix. You can use these with the diesel macros from the last couple posts for automated numbering.

Embedded Macros and how to remove them when not visible...

Not too long ago we ran across an issue with some drawing files from Autocad that we had sent to a customer that would show an error dialog box saying that there were embedded macros in said drawing file.  Well, the customer that we were providing the drawings for said that it was unacceptable and that we need to fix it.  Well, none of our designers had dealt with this issue before.  So, I researched it and was able to right a macro that would unbed the vba macro from the drawing files.
Below is the code that I had created, and all you do once you assign it to a button, is click the button and it does all the work for you.

^C^C(dictremove(namedobjdict)"ACAD_VBA");

Friday, August 2, 2013

Inventor Dynamic Simulation...

So last night I decided to mess around with Dynamic Simulation in Autodesk Inventor, and the video below is what I ended up with.  I watched a video of someone simulating the motion of a trebuchet, so I decided that i was going to build a very basic catapult and see if I could get the simulation to work on it.  So, below is my very basic catapult with the simulated arm motion and ball being thrown.

Tuesday, July 16, 2013

SaveAs through Inventor ilogic...

I use Inventor ilogic whenever possible, but one thing that has caused me problems is the fact that I couldn't save out a modified ilogic assembly without screwing up other drawings that were attached to that assembly...that is until now...
With the help from another blog; I was able to create a rule in ilogic that would perform a saveas off the assembly and then in turn would also run the rule under each part to create a brand new assembly and brand new parts within the assembly so that if you were to modify the main assembly this would not be affected by those changes.

Below is the code required for the saveas of an assembly:

'define the active document
oDoc = ThisDoc.Document
'create a file dialog box
Dim oFileDlg As inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(oFileDlg)

'check file type and set dialog filter
If oDoc.DocumentType = kPartDocumentObject Then
oFileDlg.Filter = "Autodesk Inventor Part Files (*.ipt)|*.ipt"
Else If oDoc.DocumentType = kAssemblyDocumentObject Then
oFileDlg.Filter = "Autodesk Inventor Assembly Files (*.iam)|*.iam"
Else If oDoc.DocumentType = kDrawingDocumentObject Then
oFileDlg.Filter = "Autodesk Inventor Drawing Files (*.idw)|*.idw"
End If

'set the directory to open the dialog at
oFileDlg.InitialDirectory = ThisDoc.WorkspacePath()
'set the file name string to use in the input box
oFileDlg.FileName = iProperties.Value("Project", "Project") & "_" & iProperties.Value("Summary", "Title")

'work with an error created by the user backing out of the save
oFileDlg.CancelError = True
On Error Resume Next
'specify the file dialog as a save dialog (rather than a open dialog)
oFileDlg.ShowSave()

'catch an empty string in the imput
If Err.Number <> 0 Then
MessageBox.Show("No File Saved.", "iLogic: Dialog Canceled")
ElseIf oFileDlg.FileName <> "" Then
MyFile = oFileDlg.FileName
'save the file
oDoc.SaveAs(MyFile, True) 'True = Save As Copy & False = Save As
End If

Now in my example; I have created a custom naming convention of the assembly that is controlled by the Project value, and the Title value within the iproperties. (shown below)

oFileDlg.FileName = iProperties.Value("Project", "Project") & "_" & iProperties.Value("Summary", "Title")

Now, to cause the parents under the assembly to saveas with predetermined values run the part rule within the assembly. (shown below)

iLogicVb.RunRule("2x4tube_1:1", "saveas")

When you run the rule it will automatically open a SaveAs dialog box for the assembly and once you hit save it will start running the SaveAs dialog for all the parts in the assembly that you call for the "RunRule".





Monday, July 15, 2013

Using ilogic in Inventor to control beam sizes in an assembly

Today I want to give an example of iLogic and one of the many ways that it can make designing easier.
First, is controlling Beam or frame sizes with the click of a button.
Here we have a I-beam frame


In iLogic you can write code that will manipulate the beams to allow you to select different sizes as shown below:

Once programmed then you can go into your parameters and pulldown the list for your beam sizes.

and then once you select one it will automatically update your assembly.


This is a very basic use for iLogic...one of the things that i am working on for this assembly is coding to be able to define which wall a ladder assembly will be placed and then having supporting beam members that are able to move around in the assembly depending on which wall is selected for the ladder.
So, as stated before...there are so many possiblities when it comes to using Inventor iLogic in your design process.

Thursday, June 27, 2013

Printing DataGridView's on a sheet in VB

This one is for you VB programmers out there that need a little help with the DataGridView printing.  Lately I have been writing a lot of selection and list programs, and one that I have written was for engineers to list out valves, control valves, and equipment for projects to be able to send them out for quoting and design purposes.  One issue that I ran into was being able to get the DataGridView to print each line that is entered into the grid.  But, I was able to find a bit of code and with a few modifications of my own...I was able to get it to print all lines entered into the grid, and also allow the programmer to change location of the grid on the printdocument file.
So, below is the code for the datagridview:

Dim mRow As Integer = 0
Dim newpage As Boolean = True
Private Sub PrintDocument1_PrintPage(sender As System.Object, e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim tmpSize As New SizeF()
Dim tmpFont As Font
For i As Integer = 0 To DataGridView1.Columns.Count()
tmpFont = DataGridView1.ColumnHeadersDefaultCellStyle.Font
If tmpFont Is Nothing Then
tmpFont = DataGridView1.DefaultCellStyle.Font
End If
For j As Integer = 0 To DataGridView1.Rows.Count - 1
tmpFont = DataGridView1.Rows(j).DefaultCellStyle.Font
If tmpFont Is Nothing Then
tmpFont = DataGridView1.DefaultCellStyle.Font
End If
Next
Next
Dim cellsPerRow As New List(Of Integer)
Dim rowHeight As Integer = DataGridView1.ColumnHeadersHeight + DataGridView1.Rows(0).Height
Dim cellWidths(DataGridView1.Columns.Count - 1) As Integer
Dim rowWidths As New List(Of Integer)
Dim cellCounter As Integer = 0
With DataGridView1
Dim fmt As StringFormat = New StringFormat(StringFormatFlags.LineLimit)
fmt.LineAlignment =
StringAlignment.Center fmt.Trimming =
StringTrimming.EllipsisCharacter Dim y As Single = e.MarginBounds.Top + 120
Do While mRow < .RowCount
Dim row As DataGridViewRow = .Rows(mRow)
Dim x As Single = e.MarginBounds.Left
Dim h As Single = 0
For Each cell As DataGridViewCell In row.Cells
Dim rc As RectangleF = New RectangleF(x, y, cell.Size.Width, cell.Size.Height)
e.Graphics.DrawRectangle(Pens.Black, rc.Left, rc.Top, rc.Width, rc.Height)
If (newpage) Then
e.Graphics.DrawString(DataGridView1.Columns(cell.ColumnIndex).HeaderText, .Font,
Brushes.Black, rc, fmt)
Else
e.Graphics.DrawString(DataGridView1.Rows(cell.RowIndex - 1).Cells(cell.ColumnIndex).FormattedValue.ToString(), .Font, Brushes.Black, rc, fmt)
End If
x += rc.Width
h =
Math.Max(h, rc.Height) Next
newpage =
False y += h
mRow += 1
If y + h > e.MarginBounds.Bottom Then
e.HasMorePages =
True mRow -= 1
newpage =
True Exit Sub
End If
Loop
mRow = 0
End With
End Sub

So, the bit of code that is highlighted in yellow is where you can control the vertical location of the grid on the printdocument.  Also if you want to change the location of the grid horizontally then; three lines below "dim y" there is the code line for the "dim x as single" you can change the value of that to change the horizontal location of the grid.




Happy Coding!

Binding XREF's in CADWorx...

Lately I ran across an issue with trying to bind xref's within CADWorx 2013, and I would always get an error dealing with proxy objects.  Come to find out it was the parts that I had created in CADWorx Equipment that was causing the errors when trying to bind the xref's.
So, in order to fix this you must make CADWorx equipment run in the same session as CADworx plant in order for it to recognize the equipment files.

To get CADWorx Equipment to run in CADWorx Plant here are the steps that need to be done:

1. In Plant TOOLS>OPTIONS (or for those of you that use the keyboard for commands "OP")

2. On the Files tab; expand "Support File Search Path" item.

3. Click Add, and browse to the CADWorx Equipment support directory.  Shown below:

 4. Close CADWorx Plant Session.

5. Start Windows Explorer and browse to CADWorx Plant support directory.  Shown below:
 
 6. Locate the file Acad.arx, and open it using a text editor

7. Below CADWorxPlant2013.arx type in CADWorxEquipment2013.arx


Note: If CADWorxEquipment2013.arx is above the CADWorxPlant2013.arx, then the tool tips for Plant will not function properly.

8. Save and close the text editor

9. Reopen CADWorx Plant .  Equipment should start simultaneously with plant; if not then in the command line type LOADMENUEQUIP.

Tuesday, June 25, 2013

Inventor Ilogic and Estimation form creation

Creating an Estimation form with Inventor iLogic and Excel...

To be able to create an estimation form and link it to information within your Inventor model is a huge time saver in my line of work.  One thing that I have been working on is developing a form that will help our Project Managers estimate the cost of a project (at least structural steel wise) a little bit better, and quicker so that they can get initial bids out to customers quicker.

Below is a pic of the form that I have been creating:
and basically all the information but the added totals of everything is exported from an Inventor model.  Below is another pic showing the iLogic forms that are built to supply this information that also control the construction of my model.


Here is an example of how some of this is done...
SyntaxEditor Code Snippet' SyntaxEditor Code SnippetSyntaxEditor Code Snippet


'drafting hours and cost
GoExcel.CellValue("export.xls", "Sheet1", "A37")= drafting_hours
GoExcel.CellValue("export.xls", "Sheet1", "C37")= drafting_rate
'engineering cost and hours
GoExcel.CellValue("export.xls", "Sheet1", "A41")= engineering_hours
GoExcel.CellValue("export.xls", "Sheet1", "C41")= engineering_rate
'

'grating description and cost
GoExcel.CellValue("export.xls", "Sheet1", "A49")= grating_descrip
GoExcel.CellValue("export.xls", "Sheet1", "E49")= d126+1    'qty of 3ft wide panels
GoExcel.CellValue("export.xls", "Sheet1", "F49")= grating_cost

 


I have found that when you are attempting to export Bill of Material data out with a template that the template must be in a 97-2003 file format for it to work.

Monday, June 17, 2013

Somewhat automated lettering...(diesel macro)

I built this macro this morning upon a challenge issued to me a while ago.  Figured that I could post it on here just in case there is someone else out there that would ever need to use something like this.

To those who would like some way to automate lettering in AutoCAD LT...here is a Diesel Macro for LT that will allow you to atleast automate up to "AF":

*^C^C_text;\;$m=$(if, $(<=,$(getvar,userr1),7),$(nth,$(getvar,userr1), A, B, C, D, E, F, G, H),$(if,$(>=,$(getvar,userr1),8),$(nth,$(getvar,userr3), I, J, K, L, M, N, O, P)),)$(if,$(>=,$(getvar,userr1),15),$(nth,$(getvar,userr4), Q, R, S, T, U, V, W, X),)$(if,$(>=,$(getvar,userr1),23),$(nth,$(getvar,userr5), Y, Z, AA, AB, AC, AD, AE, AF),);setvar;userr1;$M=$(+,$(getvar,USERR1),$(getvar,USERR2));setvar;userr3;
$M=$(+,$(getvar,USERR3),$(getvar,USERR2));
userr4;$M=$(+,$(getvar,USERR4),$(getvar,USERR2));
userr5;$M=$(+,$(getvar,USERR5),$(getvar,USERR2));
SETVAR;USERR3;\SETVAR;USERR4;\SETVAR;USERR5;\


This macro requires more input on the users part than the number automation, but it works for a small amount of lettering.

Before you run the command for the first time you need to make sure that your userr1 is set to a value of 0, and that your userr2 is set to a value of 1 (which is for the incrementing).

When you run the command and you place the first letter; you will notice that it prompts you for the userr3, userr4, and userr5 values...just enter through these for now because you won't mess with them until a little further on.

Now, one thing that you need to keep in mind is the letters that are associated with which userr variable:

userr1 - starts at A and ends with H
userr3 - starts at I and ends with P
userr4 - starts at Q and ends with X
userr5 - starts at Y and ends with AF
knowing this will help with understanding when to change variable values as you keep going up the alphabet.  So, for example, once you place an "H"; when the prompt for userr3 appears change it to a value of 0.  Once this is done you don't have to edit it anymore; you can just keep hitting enter through the variables until the end of that letter set on the userr variable.
On another note:
If you are a AutoCAD non-Lt user then the text command is a little different for you.
Instead of:
*^c^c_text;\;
You will have this:
*^c^c_text;\;;
And then if you want to add justification to it (for example...middle center justification)
*^c^c_text;j;mc;\;;
If anyone uses this macro and has issues please comment and let us know what changes you had to make to the macro.

Thank you for reading this post!