Tuesday, 15 December 2009

Come back Catia all is forgiven...

Well I'm back (after my short spell with redundancy) working away on the skin panel drilling maps for Airbus and trying to work out how to utilise the transfer feature inside Catia V5 to perform formed surface to formed surface mapping.

It's nice to actually get to flex a bit of my VB muscle with regards to Dassaults little baby but its also very frustrating as they still haven't released all their functionality, from CAA, into VB.net yet - guess they're not likely too either as it's their intellectual property after all, especially the surface definitions.

Anyhow, for those interested in how to perform the transfer from one surface to another you'll need R18 and above with the GSD workbench and this little gen of code...

Dim hybridShapeTransfer1 As HybridShapeTransfer
hybridShapeTransfer1 = hybridShapeFactory1.AddNewTransfer(*your point / geometry*, 1)
hybridShapeTransfer1.SurfaceToUnfold = *your surface to unfold*
hybridShapeTransfer1.UnfoldedSurface = *your unfolded surface*
hybridShapeTransfer1.UnfoldType = 2
hybridBodyNew.AppendHybridShape(hybridShapeTransfer1)

The trouble is the two surfaces, the unfolded and folded, need to be the same size and area as it uses a UV matchup as far as I can tell so having different size / shaped surfaces will cause all sorts of errors...that and your geometry needs to be on the original surface else you'll have to project it first.

If you're after more info drop me a message and I'll be glad to help...

Monday, 22 June 2009

Revit 2010 doesn't support multi-thread...

In a followup to the previous posting regarding background workers and Revit 2010...

The response from AutoDesk was, they were able to reproduce the error but their application (Revit 2010) is unable to support multi-threading and as such they have raised a product improvement request to modify Revit for a future release.

Nice...well maybe one day.

Tuesday, 16 June 2009

Background workers and Revit 2010

Now here's an interesting one for you found by my colleague.

Using the Revit 2010 API and a vb.net backgroundworker extracting the Revit links from a drawing causes the an error. To be specific if you are interrogating the model and this is done in the primary thread then all works fine, but the moment you place it in a background thread you get an 'Object not set to an instance' error...

Autodesk have been contacted with a small test app and I'll keep you posted on the outcome...

Monday, 15 June 2009

Cloudiness and Intensity...you guessed it, it's all about lighting.

Had fun today trying to look into how to get the values for the global light setting and 'spotlight' out of Microstation v8i...

It appears again that the vba API is very limited and you have to open the lights manager to be able to extract the info required.

CadInputQueue.SendCommand("MDL KEYIN Lightcon dialog LightManager")

and then use the getcexpressionvalue command to actually get the values from the form for the global lighting.

getcexpressionvalue("lightConInfo->skyCloudiness", "LIGHTCON")

What a palaver...until you come to the 'spotlight' then things really start to get interesting. The only way to extract data about them (due to the light manager having another tree view like the materials manager) is to extract the properties for each light.

This is done by cycling through all the elements in the drawing cache looking for 'CellHeaders' (microstations answer to various object containers) and then get the sub elements of the header.

This will get you things like 'Intensity', 'On/Off' and 'Cone / Delta angles' after you do a bit of string manipulation.

Wednesday, 10 June 2009

Extacting info from Fitted Sections

Well seeing that the new Microstation V8i has these new / updated section views I wanted to see what info we can extract from it via the VB/VBA api.

The answer is not much, if anything at all (that's Bentley's official answer as well) so I though I would blog about it to see if anyone else had any 'crazy' ideas...

Here is a screenshot of a wall and door with a fitted section cutting the wall to 1/2 height (approx) and I'm trying to access information regarding the bounding box, section height and which plane the section is in.


Trouble is none of these attributes are available via the vb API or even appear in great detail inside the MDL documentation (unless I've missed it) so I'm not sure how to proceed.



This last picture is more for clarification that anything, how to tell at what depth the green arrow is, and how to tell if the toggles (blue mushrooms) have been moved or set to unclipped?

Wednesday, 3 June 2009

Extracting materials from Microstation via VB.net

Now this is a tricky one...

After much headscratching and support tickets bounced backwards and forwards with Bentley the conclusion was reached that the VB API is still very immature when it comes to 3D and material information.

Basically if you have an external process (that isn't using Microstations MDL language) then accessing the material assignment information (levels / solid faces etc) is nigh on impossible.

After much investigation, and a lot of time frustrated, I came to the conclusion that the treeview within the materials window is inaccessible with the API

All the infomation on the right of the screen is accessible as they are generally text boxes which the 'getcexpressionvalue' function can poke to return the selected value (record a VBA macro to get the names of the textboxes) but this method is okay only if you want the properties for the selected option in the treeview.
Away around this is to produce the .Mat output file as it should contain all the material assignment information that you can read. Trouble I found is this can be a little tempermental as sometimes doesn't produce any assignment results at all (what I found with my test drawings).


After reworking the problem (with the help of an expert Microstation driver) the decision was made to export the level infomation out through a .CSV file, and use some VB to extract the level name and material assignment, as well as producing a .pal file for material and pattern map selected values.
This approach worked well for the .csv file as it can be read into a dataset, which in turn can be easily manipulated in memory to extract the info we needed...but as you can see the .pal file is in a nasty format.


Quite a bit of string processing was needed as we were after some values within the pattern section (which doesn't always appear) but we did end up managing to extract the info which meant we've managed to get all the info we required about level material assignment and solid pattern mapping.

It would have been so much easier if Bentley had given us external application developers access to the treeview objects as well...

Monday, 1 June 2009

On your marks...

Well, after spending much of my time looking around the internet for creative solutions to many of life problems (well CAD programming related) I thought it was about time that I started grouping a few of these solution here for other to read and share.
You never know, getting the creative juices showing might spark off a few solutions...