Tuesday, October 30, 2012

Binding xref's in CADWorx Plant...

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.


Monday, October 29, 2012

Simplifying a Designers job with programs...

Engineering firms can make things complicated for Designers but having information stored all over the place where you can't find it or can't get to it.  Maybe even company standards that aren't even followed because they haven't been blessed by an engineering manager or something to that extent.  Creating a desktop program that would help centralize all the information needed by engineer or designer.  For example...the company that I am working with currently...we are working to develop standardized pipe specifications for the company to operate by.  Now, for each project that comes up a Project Engineer must select a pipe spec that suits the needs of the job without having to create a completely new spec; which would defeat the whole purpose of having standardized specs.  So, one solution that was presented was to create a selection program for the P.M.'s to use; where they can go into the program and select from a couple of pulldowns that would narrow down the spec list to only the specs that applied to the selected criterium.  Below is an example of the mentioned program.  It is a still in the works, but will definitely be an asset to the p.m.'s and designers.

Tuesday, October 16, 2012

Importing page setup from one dwg to another....

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!

Monday, October 15, 2012

Thought of the Day...

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.

Friday, October 12, 2012

Inventor Animations

Autodesk Inventor is an incredible tool...one thing that I think is incredible is the ability to create rendered animations of an assembly.  I have actually created a lot of them in my field...below is an example of one that i created not too long ago for a customer.
 
 
If you ever get a chance to learn or just play around with the studio environment within Inventor I would definitely suggest doing it.  It is an awesome tool to show how something truely works.

Tuesday, October 9, 2012

Diesel Macro for Autocad lt...

Topic of the day: Diesel Macros in AutoCAD and AutoCAD LT

I am going to continue with another example of a diesel macro that is written to insert a block and trim the line...the only difference with this one is that the 0,0 location of the block is offset from the actual center of the block.  The reason for this is that when you begin the break command; if you have the insertion point of the block on an actual line entity in that block then it will default that point as its first fence break point.
So, below is an example of a diesel macro that has the insertion point offset from center of the block and how calculate the break points to trim the line.

*^c^cattdia;0;_.insert;GATEV2;\;1;\_USERR3;\_BREAK;$M=$(GETVAR,LASTPOINT);F;@$(*,1,$(+,-.0625,$(GETVAR,USERR1)))<$(GETVAR,USERR3);@$(*,2,$(+,.125,$(getvar,USERR1)))<$(GETVAR,USERR3);
 Alright, let's go in and break this down some...

*^c^cattdia;0;
The First snippet of code that starts us off is to turn off the attribute dialog box; so, instead of a dialog box this will end up prompting you for the attribute values in the command line which we will just assign a return value to it later on.

_.insert;GATEV2;\;1;\
Here we have our insert command with the title of the block called out.  the "\" calls for user input for the insertion point.  "1" is to input the xy scale value of the block, and then the last "\" is to call for user input on the rotation of the block.

_USERR3;\
In AutoCAD there are 5 "USERR" variables that you can set and it stores that variable so that you can recall it later when you need to.  We are just using "USERR3" for this example.  So, we call for "USERR3" and then we have "\" to call  for user input; and this input is where you will put the rotation angle for you block.  So, if you inserted it at a 45° angle then you will enter "45".
Also later on you will see that we call out for "USERR1"...the default for this stored variable is "0"

Here is where we start incorporating Diesel expressions into our macro...
_BREAK;$M=$(GETVAR,LASTPOINT);F;
We start with our standard break command, and then we start our Diesel expression.  Anytime you want Autocad to evaluate a string as a diesel expression it must begin with "$M="...this is what tells Autocad that you are beginning a diesel string.  So, in this example we are telling Autocad to find the insertion point of the block since that was the last point that was used.  Once done with that then you want to move into the fence command by using "F".

@$(*,1,$(+,-.0625,$(GETVAR,USERR1)))<$(GETVAR,USERR3);
Okay, here is where you need to know the distance from the insertion point of your block to the far left edge of your block.
First we start the point evaluation with "@"; this is the old style of point definition with polar coordinates.
Then we tell it that we are going to start another Diesel expression.  So, within that first grouping of parenthesis we find "$(+,-.0625,$(Getvar,userr1)); here we are saying...starting at the insertion point I want to move -.0625, but you have to have to do this with a formula.  And when doing a formula with diesel this is how it is to be set up:
$(function,variable,variable)
Then we also have "$(*,1" here we are just telling it to multiply that previous formula by 1.
and then we pass it the system variable that we set up for the rotation of the block at insertion.

@$(*,2,$(+,.125,$(getvar,USERR1)))<$(GETVAR,USERR3);
The second point is basically set up the same way as the previous evaluation string; the only difference is I have within the first formula I am moving it half the distance of the block with "$(+,.125,$(getvar,USERR1))" and then I am telling it to multiply that formula by a value of 2.

Diesel programming is very useful when you have an office that have half the people on full Autocad and then the other half on Autocad LT.

Monday, October 8, 2012

Lisp macro for P&ID symbols

Today's Topic: Lisp macros for Autocad:

Programming for block insertion at selected point then trimming the line between the block.
*^c^cattdia;0;^c^c_.insert;BALL-VALVE;\;1;\;;^C(setq edata (entget (setq en (entlast))));^c^cbreak;\f;(setq edata (entget (entnext (cdr (assoc -1 edata)))))(setq ip1 (cdr (assoc 10 edata)));(setq edata (entget (entnext (cdr (assoc -1 edata)))))(setq ip1 (cdr (assoc 10 edata)));^c^cattdia;1;^c
So, let's jump into this and dissect this code some.
 *^c^cattdia;0;
This bit of code tells the program to not display an attribute dialog box after placing a block.  If you do want it to show just change 0 to 1.

^c^c_.insert;BALL-VALVE;\;1;\;;
Obviously this is the command for insert and then calling out the block that we are wanting to insert, but the thing that you will need to notice on this is the semicolons at the end.  Even though we told the program that we didn't want to display an attribute dialog box you still have to account for the attributes attached to the block with a return command.  So, the last 2 semicolons are representing the 2 attributes attached to the block that is being inserted.

;^C(setq edata (entget (setq en (entlast))));
This snippet of coding is telling the program to find the data from the last inserted block.

^c^cbreak;\f;
Now, we start the break command and then tell it that we want to do a fence break "f".

(setq edata (entget (entnext (cdr (assoc -1 edata)))))
Here we are telling the program to find the first attribute point which we inserted one at each end of the block being inserted.

(setq ip1 (cdr (assoc 10 edata)));
Once we have told it to find the first attribute point we then insert the code to enter in the actual coordinate points for the first point of the fence break.

(setq edata (entget (entnext (cdr (assoc -1 edata)))))
Then we repeat the process for the second attribute point.

(setq ip1 (cdr (assoc 10 edata)));^c^cattdia;1;^c
Enter this in again for the second attribute points to be passed to the break command and complete the 2-point fence break command.

And the finished product is an inserted block with line that it is attached to properly trimmed to fit the block.

Thursday, October 4, 2012

Welcome to CAD Consulting's Blog!
This is the first post of the blog with many more to come.
This blog will consist of lessons in AutoCad, Autodesk Inventor, some VB programming that will be incorporated in Inventor, and some programming with in AutoCad to help customize and make processes more efficient to help reduce the time that you are spending drafting and increase design time.

Thank you for visiting, and check back soon to see any new posts!