What's new

Building an Assembly

ftkalcevic

Member
Has anyone successfully built an assembly using an API?

I've written a program that creates boxes. It creates a new assembly, then creates new parts within the assembly. It does the sketches and extrusions to create the features of the parts. Then, to arrange the parts in the assembly, I use IADOccurrence.ApplyTransformation to rotate and translate the parts into the correct position. At this point everything looks ok, but if I then manually edit a part, it is completely messed up - it looks like the transformation has moved the sketches off their faces and then the features can't be recreated.

Is there another way to build an assembly and place the parts?
 

wathavy4

Alibre Super User
Hi.
I envy you that you created such an application!

Anyway, if you found your assembly is not usable at the way you created, the workaround I might imagine of is that you save each part first. Then insert them into new assembly.
Because, I seem to remember somebody posted some question to this thread said that he is using his own API software to assemble circuit board with part placed.

Sorry, if I misread your post and if you have done the way I proposed as above.

P.S.
Can you upload the assembly to the this thread?
We may be perhaps reproduce the symptom and understand it clearer.

Cheers.
 

ftkalcevic

Member
Thanks for your help. Your understanding of my problem is correct. I've attached the assembly. If you try to edit any part (except for basebottom, latch or hinge), edit the first sketch "body", it will look ok, but when you regenerate it, it fails.

I started to change my code to try and implemented the way you suggested - create the parts first. It was at that point I discovered I had passed an incorrect parameter to AddSketch...

Code:
AddSketch( ByVal pOccurrence As IADOccurrence, ByVal pSketchPlane As Object, [ByVal Name As String = ""]) As IADSketch

The first argument is an occurrence of the part. Since I had an occurence variable I passed that in. However, in this context, the occurrence links the sketch plane back to the original assembly. Setting this to null fixed the problem. RTFM! It also fixed another problem where I couldn't edit holes that had been created.


Thanks,
Frank
 

Attachments

  • boxes.zip
    352.2 KB · Views: 300
Top