cancel
Showing results for 
Search instead for 
Did you mean: 

Insert image on drawings in assembly

Creator
Creator

Hello,

 

I have hit a roadblock and I'm hopeful someone can help me with my problem.

 

What I am trying to accomplish is to insert an image (specifically of a Data Matrix) in the lower left corner of a drawing for all drawings in the assembly. I am getting attribute values and using them to create to Data Matrix image. Once the image is created it is inserted on the drawing and can later be read by a scanner. I was able to do this without any problems when I was testing it out on a single drawing.

 

Now that I have everything working I want to have the program recusively iterate through an assembly file and insert the image for each drawing sheet that meets my criteria. When I have done something similar in the past I would use "child.prototype.owningpart" to access the component but I'm not sure how that would work in this situation.

 

I think to accomplish this I need to make the current part in the recursion routine the displayed part, add the image to each sheet, then move on to the next part.

 

Any help with this would be appreciated.

 

Regards,

Scott

4 REPLIES

Re: Insert image on drawings in assembly

Phenom
Phenom

You probably won't need to make each the display part as long as the component part file/drawing is fully loaded.

Re: Insert image on drawings in assembly

Creator
Creator

How would I access the sheets to insert the image?

Re: Insert image on drawings in assembly

Phenom
Phenom

You will need a reference to the part file, which you can get with the code in your first post.

 

Some psuedocode:

for each comp in assembly
    dim compPart as part = comp.prototype.OwningPart
    for each sheet in compPart.DrawingSheets
        'do stuff
    next
next

Re: Insert image on drawings in assembly

Creator
Creator
I think I've got it.

sheetTag = Prototype.DrawingSheets.CurrentDrawingSheet.Tag

ufs.Draw.OpenDrawing(sheetTag)
ufs.Drf.CreateImageFromFile(imageFile, sheetTag, imageCoordinates, imageTag)