Results 1 to 10 of 10
  1. #1
    2 Star Lounger
    Join Date
    Oct 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    free form polygon in Access? (2000/sp3)

    Word, Excel, and Powerpoint all allow you to create freeform polygon shapes (Autoshapes->Lines->Freeform)... While I've never done this using VBA code, I may be needing to do so in an upcoming project in Access. But I don't even see a user option to add such a shape..

    Can you create such a shape in Access (specifically, via VBA) ? Are there any example algorithms I could reference?

    thanks,
    ..dane

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: free form polygon in Access? (2000/sp3)

    You can use Insert | Object... to insert a Paintbrush object or a Microsoft Word Picture object (the latter is what you can create in Word, but I've never been able to make it work in Access). But what would be the purpose in a database application?

  3. #3
    2 Star Lounger
    Join Date
    Oct 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: free form polygon in Access? (2000/sp3)

    > But what would be the purpose in a database application?

    I never thought you'd ask, Hans... :-)

    Fairly simple situation; I am electrical engineer, and develop PCBs as my primary task. Not sure how much you know about PCB design, but in short: I design a PCB, and that PCB has a particular shape to it, with parts all over the place to make it work. All of this data (component locations, rotations, PCB outline, etc) is represented in an Access database generated by the PCB design tool. Once the PCB design is complete, it is put into what's called a PCB panel, which adds material around the particular PCB outline to make it a retangular shape, so that the machines producing the board can 'grip' the panel more easily (simplified). Additionally, a PCB panel can be made very large and include multiple individual PCBs at different angles within the PCB panel (think of a jigsaw puzzle).

    As a task secondary to my design role, I'm building a tool to help process PCB panel data (simplified). One feature that is not necessary but would be a really nice addition is a "preview" button that draws a representation of the PCB panel, based on the PCB outlines of each PCB within the panel (each PCB offset and rotated properly as defined within the panel).

    I see two possible solutions:

    (1) use some sort of external tool (commandline driven, non-GUI), given a set of line segments, to generate a bmp/gif/jpg image of the PCB panel, and then just pop up a window displaying the image. Pros are that I don't have to write an algorithm, and that it can be done real-time. Cons are that I need an external tool, and currently I don't know of one that will do that.

    (2) utilize something similar to the "Free Form" drawing object found in word, excel, and powerpoint to generate the image myself from the set of line segments. Pros are that I have control over the algorithm and how it is displayed, and can be done real-time. Cons are that I currently don't know how to invoke a free form shape in Access.

    Sorry if that reply's too long; but I bet you fully understand now what I'm looking to do...

    I've thought about invoking a powerpoint object, creating a blank slide, and use the powerpoint freeform shape tool to generate the image. But if I could do it without invoking a PowerPoint object, that'd be sweet....

    have a great weekend,
    ..dane

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: free form polygon in Access? (2000/sp3)

    I think the general answer is, "don't." Access is a database, but it is doesn't handle storing graphics well and it isn't designed to manipulate graphics at all. You could, with some effort, build a report that would draw a shape based on the data points you supply, however you would have to do it entirely in code using the Line method.
    Charlotte

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: free form polygon in Access? (2000/sp3)

    Access doesn't have built-in drawing tools, so it will have to be an embedded object or an external application. A PowerPoint slide may not be a bad idea. Make sure that you set Enabled = Yes and Locked = No.

  6. #6
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,613
    Thanks
    3
    Thanked 58 Times in 58 Posts

    Re: free form polygon in Access? (2000/sp3)

    Let me suggest an alternative - save your objects in Access for each design, not as a graphic, but simply a series of numerical records with position, size, etc. Then use Automation to Visio to actually draw the PCB layout. Visio is much better suited to this sort of thing than PowerPoint, and works quite well with Access. In addition, it has a much more robust VBA implementation, and exposes most of the Visio object model to Automation. (It works pretty well for creating data base documentation because of that.)
    Wendell

  7. #7
    2 Star Lounger
    Join Date
    Oct 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: free form polygon in Access? (2000/sp3)

    Thanks Charlotte, Hans, and Wendell for all jumping in with suggestions..

    Of all the options, I'll probably look into an embedded Powerpoint slide. I may also look into the suggestion of a report with dozens of line segments... the data is stored as dozens of sets of line segments anyway, so it would not be too difficult to do something like that.

    thanks again,
    ..dane

  8. #8
    2 Star Lounger
    Join Date
    Oct 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: free form polygon in Access? (2000/sp3)

    Alright, I've stumped myself again.

    Sorry if this is a newbie question, but I can't find anything in the help files...

    I've gone into PowerPoint and played around with the Polyline object, successfully creating, resizing, and moving it around to get comfortable with the object..

    I'm now back in Access, and on a form have added an Object->PowerPoint Slide, which I've named pptPreview. I've also got a command-button called cmdGeneratePreview. And within the pptPreview slide I've even got the subroutine (subDrawPolyline()) included to genreate the polyline shape.

    Now -- how do I invoke subDrawPolyline() from within the Access command button cmdGeneratePreview?

    thanks,
    ..dane

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: free form polygon in Access? (2000/sp3)

    I would put the code in Access instead of in the embedded slide. Here is an example:

    Private Sub cmdGeneratePreview_Click()
    Dim sld As PowerPoint.Slide
    Set sld = pptPreview.Object
    With sld.Shapes.BuildFreeform(msoEditingAuto, 229.62, 105.62)
    .AddNodes msoSegmentLine, msoEditingAuto, 121.88, 247.38
    .AddNodes msoSegmentLine, msoEditingAuto, 269.25, 445.75
    .AddNodes msoSegmentLine, msoEditingAuto, 513.12, 355#
    .AddNodes msoSegmentLine, msoEditingAuto, 450.75, 150.88
    .AddNodes msoSegmentLine, msoEditingAuto, 229.62, 105.62
    .ConvertToShape
    End With
    Set sld = Nothing
    End Sub

    Notes: this requires that you have set references (in Tools | References...) to the Microsoft Office 9.0 Object Library and to the Microsoft PowerPoint 9.0 Object Library.

  10. #10
    2 Star Lounger
    Join Date
    Oct 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: free form polygon in Access? (2000/sp3)

    Awesome! I like much better having all the code in the databse vba, not in the embedded object.

    Thanks for all your help. Working well now....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •