Friday, April 20, 2012

What's the point?

3D Printers, Laser Scanners, photogrammetry. Some of the words being thrown around more and more often in the ever accelerating field of rapid geometry creation, both in digital and physical forms. When you get past all the glossy brochures and marketing guff, real-world results from 3D scanning often leave a lot to be desired and don't prove to live up to the promises often made by the various vendors providing these services. I believe that more often than not, this is because a solution may have not been well enough thought out, or too much demanded of the technology. One of the most debated areas of 3D scanning and post-processing of the captured data at the moment, is automated object recognition and solids creation from a scanned point cloud. I'm yet to see a demo of this technology that would be really useful in a real-world industry application. What I have seen so far have been "bits and pieces" of concepts that might work when fully mature.

With this in mind, I thought I'd reduce my demands in terms of what I was asking of the scanned geometry, and come up with a workflow that may be useful using some of the new tools in Autodesk Inventor 2013. The following steps outline the process I followed:

Scenario: I have a radio-controlled model aircraft that contains a GPS guided autopilot (Ardupilot.) I plan to add a GoPro camera to allow me to record my flights from the air. The only logical place to mount the camera is where the canopy used to be. To build a mount that neatly fits the canopy opening, I could trace and cut the parts by hand, but with access to a laser scanner (thanks to a demo by http://www.qubic.com.au) and the Autodesk Product Design suite of products, I thought I'd try and be a bit more "high tech" about it.

Here is the plane:
Manual Control

With Canopy Removed

The first challenge was getting the laser scan data into a point cloud format that was readable by Inventor. Inventor 2013 has tools for importing pointclouds but they currently have to be in .pcg format. The data I had from the scanner was either .obj or .asc. Having never heard of .asc, I thought I'd give Autodesk 3DS Max a go as I knew it could handle the obj format and it was in my Product Design Suite already. It imported the .obj fine and this is the result:


This is where I got stuck. I now had a polyfaced mesh but I really wanted the point cloud in Inventor and realised my mistake. Luckily, I found a product called Kubit Pointcloud which has a free edition with limited functionality that runs inside AutoCAD. With this I could import the .asc file (which I found out is just an ASCII file) which also converted it to the Autodesk .pcg format. Here is the point cloud being imported and converted inside AutoCAD:

Kubit Pointcloud Plugin for AutoCAD

Now I had my .pcg for Inventor 2013!

Using box crop tool to retain useful points in Inventor 2013

From here, I converted some of the pointcloud points to Inventor workpoints and then created a couple of workplanes on the geometry that I wanted to use as a guide.

On one of these workplanes, I created a 2D sketch and traced the shape of the canopy using a spline. I found the new "self-symmetric" spline mirror tool very useful here as I just needed to trace half of the finished shape and it made the other side continuous automatically.


Finally, a simple extrusion, and I had the first component in my camera mount ready to continue design.
I found this to be a very useful workflow once I figured out the file conversion steps. For complex shapes this could save a huge amount of time and allow you to design "in-situ." It would be great to hear your feedback on potential applications for this.


Monday, February 20, 2012

RectANGLE

Just a quick and easy one here. If you get frustrated placing a rectangle and then having to delete constraints to adjust it's angle, use the 3-point rectangle tool. It allows you to place the first line on an angle which you can later constrain with a dimension.






Wednesday, November 9, 2011

Variable Pitch Auger Creation

Recently one of our customers asked for a workflow to create a variable pitch Auger. Here is one process.



1.             Create cylinder or shaft for auger. Name parameter for diameter as "D"




2.             Create workplane tangential to outside surface of cylinder.





3.             Open "Parameters" and create a new unitless numeric parameter called "Num_revolutions" and give           it a value of say, "6ul".



4.             Create sketch on newly created plane and constrain endpoint to the centreline of the auger shaft.                Draw a horizontal line extending outwards from this point and dimension it with the value        PI*D*Num_revolutions. Draw a curve or series of lines and arcs to represent the change in pitch. In     this example I have used a spline. The other sketch lines are just construction geometry and the                 dimensions on the left hand side are just to show the various pitches for each of the revolutions. This           geometry can be contructed and dimensioned however you like. Finish the sketch.






5.             Create a new 3d sketch and select "Project to Surface." Pick the outer face of the cylinder as the face, the curve in the 2d sketch as the curve, and depress the "Wrap to Surface" button. Click OK.





6.             Create a workplane through the central axis of the cylinder, normal to the tangential plane you      created earlier. Create a new sketch on this plane and project the endpoint of the wrapped 3d sketch               into it. Draw a line to represent the height of the flighting.

 


 7.             Using the "Sweep" command, select the "Path and Guide Surface" option from the dropdown list. Pick          the vertical line you drew as the profile, the 3d helix as the path, and the outer surface of the cylinder              as the guide surface. This will create a surface that represents the flighting.


8.             Using the thicken command, thicken the surface you just created to create the flighting. If this thicken          fails, chances are it is because the flighting pitch is too small in some area.


The next step could be to split it up into segments to make it manufacturable. If you need ideas on this, give us a call. 

Monday, September 26, 2011

Different strokes for different folks

Level of Detail representations (or LODs) in Inventor can be very useful for a number of tasks. Most people who have used them are likely to have done so for the purpose of reducing the complexity of an assembly for performance reasons. When using them in this sense, components can be suppressed to prevent them from loading into memory or being visible in the display window. The BOM ignores the suppression however and treats them as active. This is great if that is the behaviour that you're after, but if you are creating LODs to represent various configurations of an assembly then you may want the BOM to ignore components that have been suppressed. Enter iLogic (and more importantly the Component.IsActive command).

Here are a series of screenshots to show both workflows.

Assembly of 3 components with BOM
Here you see an assembly that consists of 1 x Block A and 2 x Block B, which are shown in the BOM as you'd expect.

Now let's pretend we'd like to simplify the assembly (for performance reasons) by creating a new level of detail and simply suppressing one of the "B" blocks.

Assembly with B block suppressed for performance
The BOM quantity still shows 2 x Block B even though one has been supressed.

And now we'd like to simplify the assembly in the same way, but for configuration reasons and therefore, we want the BOM to reflect the assembly we see on the screen.

I first created a new LOD and then created an iLogic rule to suppress 1 of the "B" blocks using the following code:

Component.IsActive("PART B:2") = 0

And this is the result:

Assembly with B block suppressed to show a configuration
The BOM quantity shows 1 x B Block as a normal component and 1 x B Block as a reference component. The reference component will not show in a parts list so the drawing of this configuration will only show 1 x A Block and 1 x B Block on the drawing view as well as the parts list.

If you're on our CSP program and would like further explanation of this, give us a ring.


Thursday, September 8, 2011

Displaying k-Factor on an Inventor drawing

One of our customers recently asked us how they could display the k-factor for a sheet-metal part on a drawing. This is not as easy as pulling a parameter through to the drawing as the k-factor value is embedded in the sheet-metal style of the component. Using iLogic to access the inventor API, we created a custom iProperty and pushed the k-factor from the current sheet-metal style through to it. The iLogic rule code is shown below: 


oCompDef = ThisDoc.Document.ComponentDefinition
      kFac = oCompDef.UnfoldMethod.kFactor
            iProperties.Value("Custom", "kFac") = kFac

This writes the k-factor value through to a custom iProperty called "kFac."

For those new to iLogic, to use this rule code you will first need to display the iLogic browser inside Inventor by clicking the "iLogic Browser" button on the "iLogic" panel of the "Manage" tab. It should appear on the left of the screen below your model browser. 

Display iLogic Rule Browser

Click the "Rules" tab and right-click in the panel and select "Add Rule." Give the new rule a name. The rules editor will open and you can simply copy-paste the above code into the code window and click "Ok." The rule will fire immediately and create a new custom iproperty and populate it with the k-Factor value.


Custom iProperty created and populated by rule




From there, to put the k-Factor into a drawing you can place a text box from the "Annotate" tab and bring in the custom "kFac" property. You can also add a text label eg. "k-Factor" as normal text.



Insert custom iProperty in Text Box


And that's it.


Finished!



Friday, November 26, 2010

How important is your Vault data? Part2

In our previous post we discussed some of the issues of protecting your Vault data, and highlighted the advantages of using ADMS backups.
What we wanted to do know is give you an example of an ADMS script, break it down so you can see how it works, and then give you  helpful little utility to make it all the better.
In the Advanced Configuration Guide (all versions available from Advanced Configuration Guide for Autodesk data management server) you will find "Configuring Automatic Backups" and there it will describe how to set  up a scheduled task, and it also gives and example batch file.
If we all had endless supplies of disk space, then using a cascaded backup would be no issue. Unfortunately for most users this is not the case.
Also the example makes no account of errors, so that if the backup script shown fails for 2 nights, there would be no backup left to go back to (on the 1st night B would be deleted and A moved to B, on the second night B would be deleted and there would be no A).
So we have done a little bit of work on the script , here it is with section explanations
First we set up variables. This means if we want to change the Backup folder from C: to D:, we need only change the set VltFld line to handle this
@echo off
REM **Set vault Folder reference
set VltFld=C:\Vault
REM **SET Backup Folder Names
REM **Set vault Backup root Folder reference
set VltBckFld=%VltFld%\Backups
REM **Set vault Backup Temp Folder reference
set VltBcktmpFld=TMP
REM **Set vault Backup Target Folder reference
set VltBckTgtFld=A
REM **Set vault Backup Cascade  Folder reference
set VltBckCscFld=B
REM **Set vault Logs  Folder reference
set VltLogFld=%VltFld%\Logs
REM **Set Temp Backup Log
set TmpLogFile=VaultBackupTmp.log
REM **Set Target backup log
set TgtLogFile=VaultBackup.log
When a Vault backup is run, a folder called VaultBackupxxxxxxxx is created, where the xxxxxxx is today's Date and time. this means we never know what the folder is going to be called. By housing the backup in a Folder we definitely know the name of, we can then control its deletion and creation. So we Create folders A & B to hold the last and last but one backup
At this point we remove the Cascaded backup folder. If you are going to run a one backup folder system, Either REM the  rmdir /Q /S %VltBckFld%\%VltBckCscFld% and the later line ren %VltBckFld%\%VltBckTgtFld% %VltBckcscFld% that moves the old A to B
REM **Remove and the Cascaded Backup
rmdir /Q /S %VltBckFld%\%VltBckCscFld%
If the last backup failed for some reason, we may still have our temp holding folder that we need to get rid of.
REM **Remove (in case) and recreate temp Holding Folder for Backup
rmdir /Q /S %VltBckFld%\%VltBckTmpFld%
mkdir %VltBckFld%\%VltBckTmpFld%
We get rid of any old log files
REM **Delete old Log files
del %VltlogFld%\%TmpLogFile%
del %VltlogFld%\%TgtLogFile%
Now run the vault backup to our temporary folder. By creating a log file, we can later test to see if the backup finished or crashed out
REM **Backup up to temp folder location and to temp log file
"C:\Program Files\Autodesk\ADMS 2011\ADMS Console\Connectivity.ADMSConsole.exe" -Obackup -S -DBSC -B%VltBckFld%\%VltBckTmpFld% -VUAdministrator -VP -L%VltlogFld%\%TmpLogFile%
We check to see if the backup log file was created. this gives us a decent check on whether the backup managed to run. If there was an error but the log file was created, we will see this in the log contents.
REM **If the backup failed, there will be no log folder,
IF EXIST %VltlogFld%\%TmpLogFile% GOTO SUCCESS
REM **If we are here, the backup failed, pass in the excpected log file,
REM **the email script will see this is missing
REM **and react accordingly
call EmailLogs.bat %VltlogFld%\%TgtLogFile%
GOTO FINISH
If the backup succeeded we can rename folders and log files (as mentioned previously, if not using a cascaded backup, REM out the A to B line)
:SUCCESS
REM **Rename backup folders
REM **Rename A to B
ren %VltBckFld%\%VltBckTgtFld% %VltBckcscFld%
REM **Rename TMP to A
ren %VltBckFld%\%VltBckTmpFld% %VltBckTgtFld%
REM **Rename Backup Log
ren %VltlogFld%\%TmpLogFile% %TgtLogFile%
call EmailLogs.bat %VltlogFld%\%TgtLogFile%
GOTO FINISH
:FINISH

You will notice the 2 lines in the above that call EmailLogs.bat. this is a second batch file that handles informing the user of the status of the backup. To do the emailing you can use programs like Blat, but we have seen some issues with Exchange 2007, so we have written our own little mailer, CPS.MiniMailer to handle this task. You are welcome to use this and let us have feedback on any issues.

The MiniMailer config file (CPS.MiniMailer.exe.config) contains sections for all the below. By setting them in the config, you can omit them from the batch file (see this post Command Line Mailer for fuller explanation on this)

@echo off

:::::::::::::: Lets set some variables ::::::::::::::
REM **Apart from the attachment, the rest of these variables
REM **can be set in teh mini mailer configuration if required
set attach=%1
set eMailto=-t greg.h@cadpro.co.nz
set eMailfrom=-f greg.h@cadpro.co.nz
set subj=-sub "Vault Server Backup Log"
set server=-srv 192.168.88.1
set body=-b "Vault Backup Log File"
 We try to find the log file (which was passed as the 1st parameter to the batch file)
::::::::::::::::: Now we run Email Sender:::::::::::::::::
IF EXIST %attach% GOTO MAILLOG
REM **Rest teh subject to an error ttype
set subj=-sub "Vault Server Backup Error"
"CPS.MiniMailer.exe" %eMailto% %eMailfrom% %subj% %body% %server% 
GOTO FINISH
:MAILLOG
"CPS.MiniMailer.exe" %eMailto% %eMailfrom% %subj% %body% %server% -a %attach% 
:FINISH
What you should find is that when you run the VaultBackup.bat file, you should get an email upon completion. If the process failed (which is easily simulated by leaving ADMS console open and running the batch file) you will see a subject of "Vault Server Backup Error", if it completes you will have a copy of the log file attached.
You can download the batch files and command line mailer from here Vault Backup Utilities 
The above are by no means the last word on this subject, but hopefully they give you some ideas and start points for you to move on from.


Command Line Mailer

For a lot of situations, a command line emailer comes in really useful

In the past I have used Blat, which has suited my needs perfectly. However in recent times, I have had more and more issues with Exchange and firewalls, so decided to see if I could write one for my needs.
And so came about CPS.MiniMailer. Its not very sophisticated (yet) but it does allow me to send mails through our Exchange 2008 server, as well as Google Mail.
Heres a breakdown of the switches

CPS.MiniMailer.exe
-hDisplays list of switches
-srvSMTP server address or name
-pSMTP Port number
-tMail To (multiple addresses separated by commas
-fMail From
-subSubject (enclose sentence in double quotes)
-bBody (if HTML mail, can be html formatted string)
-duDomain user (Exchange) or user name (GMail etc)

-dppassword for -du
-html1 for HTML formatted mail, 0 for plain text
-aAttachments, surround paths with double quotes, multiple files separated by comma's
With the mailer comes a config file, CPS.MiniMailer.exe.config and all the above values (apart from attachments) can be preset there, really useful for Mail server and user name. However if you pass in a switch, this will override the config value with your switch one, really useful for subject, body etc.
To edit the config file, open it into notepad, and find the relevant setting (so for the From setting we would look for <setting="From" serializeAs="String"> )and then edit the the text between the <value> and </value> tags.

An example of a command line (or batch file) using GMail is
CPS.MiniMailer.exe -srv smtp.gmail.com -p 587 -f mylogin@gmail.com -t blogs@cadpro.co.nz -sub "Test Gmail Mail" -du mylogin@gmail.com -dp myPassword
And for exchange

CPS.MiniMailer.exe -srv myExhcnageSrv -p 25 -f myname@mycompany.com -t blogs@cadpro.co.nz -sub "Test ExchangeMail" -du myDomainName -dp myDomainPassword

You can download the mailer from CADPRO Systems MiniMailer Utility

Please post any questions or comments, and when changes are made we'll append to this blog