Friday, 28 November 2014

Identify drawing view type



I was looking into identifying the drawing view types so I can add it to the view label and decided to share the code with you guys. I am taking about checking if it's a main, projection, section,detail, etc. type of view.
Lots of places to use this code and one that comes to mind is adding a description to all secondary views (details, sections, projections) of what the main view is called, labelled and on what sheet it is.

Hope it’s self-explanatory (let me know if you need more help with it).
 
 
'------------------START CODE--------------- 
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument

Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView

Dim i As Long
i = 1
For Each oSheet In oDrawDoc.Sheets
'For Each oSheet In oSheets
    oViews = oSheet.DrawingViews
    For Each oView In oViews
        MessageBox.Show("View No.: " & i & _
        vbLf & "View Name: " & oView.Name, "View ID")

        Select Case oView.ViewType
            Case 10506 ' could use kAssociativeDraftDrawingViewType
                MessageBox.Show("View is associative draft one", "View Type")
            Case 10499 ' could use kAuxiliaryDrawingViewType
                MessageBox.Show("View is associative draft one", "View Type")
            Case 10498 ' could use kCustomDrawingViewType
                MessageBox.Show("View is auxilliary one", "View Type")
            Case 10497 ' could use kDefaultDrawingViewType
                MessageBox.Show("View with customized camera settings", "View Type")
            Case 10502 ' could use kDetailDrawingViewType
                MessageBox.Show("View is a detail of a portion of the document", "View Type")
            Case 10505 ' could use kDraftDrawingViewType
                MessageBox.Show("View is a draft one", "View Type")
            Case 10500 ' could use kOLEAttachmentDrawingViewType
                MessageBox.Show("View is an OLE attachment", "View Type")
            Case 10507 ' could use kOverlayDrawingViewType
                MessageBox.Show("View is an overlay one", "View Type")
            Case 10504 ' could use kProjectedDrawingViewType
                MessageBox.Show("View is a projected one", "View Type")
            Case 10503 ' could use kSectionDrawingViewType
                MessageBox.Show("View is a section", "View Type")
            Case 10501 'could use kStandardDrawingViewType
                MessageBox.Show("View with the camera set to one of the " _
                & vbLf & "standard orthogonal views (Top, Iso, etc.)", "View Type")
            i = i + 1
              End Select
      Next
Next
'------------------END CODE--------------- 
  
Try it out, it will show the view name and type.
ADS.

Wednesday, 26 November 2014

Tube and Pipe 2



Continuing on tube and pipe tutorial from last week we are going to discuss the styles, and parameters that I like to have before doing any routes.
So you’ve started the tube and pipe assembly, maybe you gave it a name to detail it on a separate drawing, maybe not, because you are detailing it on the main assembly drawing. You have constrained the tube and pipe assembly flush on the origin of your main assembly and hopefully you have constrained the runs as well, just to make sure they can’t be dragged by mistake.
Once inside the route I like to project (include) the run planes and set them to auto-resize just in case I need some references for constraining my route. You want to use as little as possible any references that might change, making you re-dimension, re-constrain your route. If I can’t fully constrain my route by itself I sometimes use the included planes of the runs to lock it in place trying to keep it local. Sometimes no matter how many constrains you add, the route will not change colour, will not become fully constrained. If you drag the sketch from various nodes and it's not moving then leave it, it might never get fully constrained.


Now you need to look into the styles of pipe and fittings you want to use for your route. I don’t have any styles in the default template “piping runs.iam” located in the design data folder. This way I don’t need to worry about migrating my template when a new version of Inventor ships in. I had a lot of tube and pipe assemblies crash on me so this will ensure the template stays correct. I do however have preset styles that I import for each new type of pipes and runs. I have a style for ABS, PP, SS, PVDF, PVDF-HP, and so on. Each xml export has all the sizes available for that style, so I don’t have to import 1” and 2” ABS, all the possible sizes for ABS are imported all at once.


 I need to specify that the pipe length and increment in each of my styles have a really small value like 0.001 so that I can have consecutive fittings at different angles one after the other. This helps with fittings that have an exact engagement like “to point / plane”. The engagement percent takes into account the pipe length increment. The bigger the value, the more you will end up with gaps to compensate between pipe length (min+increments) and distance between nodes (fittings) which might not be divisible by the pipe lengths and its increments.



Till next week...
Adrian.



Thursday, 20 November 2014

Tube and Pipe 1



I have managed to do a Tube and Pipe video last week and it’s time we get it digital, print out for those of you who prefer it. I am sure a lot of new things and corrections will surface so today we will have part one out of … the many number of posts we need to get it Right (maybe never ?).
There’s no better start than customizing the environment to use multi-character commands. I can’t stress enough how much this will speed up your design process. On average using the keyboard is four times faster that hunt and picking with the mouse. David Allen, the productivity guru points out that using the mouse instead of the keyboard “is like talking with marbles in your mouth”. You would find it almost impossible and you would feel stupid for talking with marbles in your mouth so, on the same principle, don’t feel stupid - use the keyboard?
Nine years ago I left the design office, Inventor , Autocad, and CAD altogether which I’ve been using for a year to supervise and help starting up a couple of steel processing plants. This whole thing lasted four years, time in which I never used Inventor, and rarely Autocad. Going back to design office I had a hard time, finding the commands again, I was hunting for the right icon on the right menu, until one day, when in a hurry I started a sketch and without knowing my hand pressed a key that activated the circle command that I needed. I couldn’t tell you what the shortcut was but my hand knew it so I realized that it really is like “riding a bicycle”, and that I can relax, it will all come back in time with practice. Four years later I ended up creating a drawing in 20 seconds for simple rectangular parts (save and all) and my manager at the time keeps telling me he hasn’t seen anyone as fast as I was.
Anyway, I suggest you head over and right click on the ribbon and select “Customize User Commands”, then switch over to the “Keyboard” tab and activate the “Use default multi-character Command Aliases”. If you use Autocad I recommend you try and set as much possible the same shortcuts. Again, my hand might pick the right command when I switch between Autocad and Inventor but I l try and keep it simple.




Some of my shortcuts for tube and pipe:
-          PR – new run
-          NR – new route
-          IG – include geometry (to get planes and faces for dimensioning)
-          RT – create route
-          D – dimension
-          CC – coincident constrain
-          CL – collinear constrain
-          II – parallel constrain
-          PL – perpendicular constrain
-          PF – place fitting
-          CS – change size
When you start the Tube and Pipe environment, you are prompted for the default location and name of the assembly and of the first run.
If you are going to detail the tube and pipe assembly on a separate drawing instead of having it on separate sheets of the main layout then I suggest you rename the “Default.Tube and Pipe Runs “ that Inventor suggests. I gave it a project specific number so I can have it in the title block of the tube and pipe drawing.



DON’T rename the Run, and the Route names EVER. I know you have it all organized and it’s all planned on how each run has a route each of a specific size so you feel tempted to put that size in the filename. DON’T. If you ever changed the size of the route you will only confuse youself and the colleagues that need to work on your project.
Once you are in the Tube and Pipe environment, exit, save and constrain the assembly. All levels of T&P are adaptive so the geometry will adapt to the design intent but it’s not constrained so if you drag it by mistake it will move. You might not ever realize you moved it and you will go nuts trying to find why you have “Violations” in routes or why they are skewed. Do a flush constrain on all plain origins to the main assembly origin. Can’t use Productivity / Constrain and Ground at Origin because Grounding is not possible, it’s not even available in the right click menu.




That’s it for now, check back next week when we will detail some more.



ADS

Friday, 14 November 2014

Tube and Pipe

I have been working long hours trying to get this Tube and Pipe video out and I just missed my deadline. One rule that impose myself was to do a post at least every week and it's usually published Thursday midnight.

There was no time for a proper blog on the all the info in the video but I will draw from it for the next couple of posts where I hope to add images and detailed explanations.

Because it's rather long I suspect some of you might get bored quite a lot but I recommend that you watch it over the lunch break just to see if there's anything new you can get from it.

Please send back your comments as well as best practices and other tips that you might have.






Wednesday, 5 November 2014

Browser name code update

Hi guys,

Short post today.

I have been really busy lately, trying to get together a list of best practices for tube and pipe along with Chris Benner (the guru instructor). Check his blog here.
There has been also tests on the latest version of mExtension which I hope to present shortly. It's been working on all versions but further tests need doing. like 32 and 64 bit, winxp or 7 as many inventor versions possible.
I have had long days helping out Inventor forum and especially a lengthy post on frame generator which I also hope to bring to you soon.

Meanwhile I have updated a bit the code that changes the browser name (occurrence name) which I use to tag my valves and instrumentation.

In this version, while you select parts in the graphical window you will get a prompted entry with the existing occurrence name and the new one you want in.

Here it is:

'-----------start code
Dim comp As Object

Try
    While True
        comp = ThisApplication.CommandManager.Pick(
            SelectionFilterEnum.kAssemblyLeafOccurrenceFilter,
            "Select a component")
        oTagOcc = InputBox("Enter Tag No: ", "Tag Prompt", comp.Name)
            comp.Name = oTagOcc

    End While
Catch ' do nothing if error

End Try
' ------------ end code

Have a great day
Adrian.