boomoto Posted June 21, 2010 Share Posted June 21, 2010 As the title says I'm trying to import BMP files into a drawing. I understand that there is a command called " IMAGEATTACH" this would work if I could automate it. Basically what I'm doing is I have a program that grabs info from the .dwg then displays it to a form, the user then selects part of the drawing to take a picture of which then exports the the selected lines to a .BMP then creates a new .dwg with the part information. To this point the program works flawless, however I have no idea how to import the the .BMP file back using VBA and have been searching the web for a good bit. So please help Quote Link to comment Share on other sites More sharing options...
JohnM Posted June 21, 2010 Share Posted June 21, 2010 use the -image command this will give you command line prompts with no dialog box Quote Link to comment Share on other sites More sharing options...
boomoto Posted June 21, 2010 Author Share Posted June 21, 2010 use the -image command this will give you command line prompts with no dialog box Hmm ok, getting somewhere with this; however still can't figure out how to make it all command with no pop up Could you give me an example just to place an image anywhere within the drawing without any interaction other then command line. I will keep trying but if you know it could save me loads of time lol. Thanks Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 21, 2010 Share Posted June 21, 2010 (defun AT:Image (image pt scale ang / obj) ;; Insert image into drawing ;; Alan J. Thompson, 06.21.10 (if (findfile image) (if (not (vl-catch-all-error-p (setq obj (vl-catch-all-apply (function vla-AddRaster) (list (if (or (eq acmodelspace (vla-get-activespace (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))) ) ) ) (eq :vlax-true (vla-get-mspace *AcadDoc*)) ) (vla-get-modelspace *AcadDoc*) (vla-get-paperspace *AcadDoc*) ) image (vlax-3d-point pt) scale ang ) ) ) ) ) obj ) ) ) Quote Link to comment Share on other sites More sharing options...
boomoto Posted June 21, 2010 Author Share Posted June 21, 2010 (defun AT:Image (image pt scale ang / obj) ;; Insert image into drawing ;; Alan J. Thompson, 06.21.10 (if (findfile image) (if (not (vl-catch-all-error-p (setq obj (vl-catch-all-apply (function vla-AddRaster) (list (if (or (eq acmodelspace (vla-get-activespace (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))) ) ) ) (eq :vlax-true (vla-get-mspace *AcadDoc*)) ) (vla-get-modelspace *AcadDoc*) (vla-get-paperspace *AcadDoc*) ) image (vlax-3d-point pt) scale ang ) ) ) ) ) obj ) ) ) That looks good however I need it for a VBA program so either i need the command lines for it or a way to do it Using VBA thanks though. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 21, 2010 Share Posted June 21, 2010 Example from help: Sub AddRaster ( ) ' This example adds a raster image in model space. ' This example uses a file named "raster.jpg." ' You should change this example to use ' a raster file on your computer. Dim insertionPoint(0 To 2) As Double Dim scalefactor As Double Dim rotationAngle As Double Dim imageName As String Dim rasterObj As AcadRasterImage imageName = "C:\raster.jpg" insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0# scalefactor = 1# rotationAngle = 0 On Error Resume Next ' Creates a raster image in model space Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotationAngle) If Err.Description = "File error" Then MsgBox imageName & " could not be found." Exit Sub End If ZoomExtents End Sub Quote Link to comment Share on other sites More sharing options...
boomoto Posted June 21, 2010 Author Share Posted June 21, 2010 Example from help: Sub AddRaster ( ) ' This example adds a raster image in model space. ' This example uses a file named "raster.jpg." ' You should change this example to use ' a raster file on your computer. Dim insertionPoint(0 To 2) As Double Dim scalefactor As Double Dim rotationAngle As Double Dim imageName As String Dim rasterObj As AcadRasterImage imageName = "C:\raster.jpg" insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0# scalefactor = 1# rotationAngle = 0 On Error Resume Next ' Creates a raster image in model space Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotationAngle) If Err.Description = "File error" Then MsgBox imageName & " could not be found." Exit Sub End If ZoomExtents End Sub Alright that is what I was looking for This hopefully should work, I did a quick test and it does place an image for me so hopefully I can get it to the right size and position now I'm assuming that the intersection would control that. Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 21, 2010 Share Posted June 21, 2010 Example from help: Ahh, using HELP, what a marvelous idea. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 21, 2010 Share Posted June 21, 2010 Ahh, using HELP, what a marvelous idea. ............ Quote Link to comment Share on other sites More sharing options...
boomoto Posted June 21, 2010 Author Share Posted June 21, 2010 ............ LOL I used helped from VBA/Cad and google for a good 2 hours of searching, which help did this come from? this site? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 21, 2010 Share Posted June 21, 2010 VLIDE Help file. Quote Link to comment Share on other sites More sharing options...
mustaf Posted July 15, 2010 Share Posted July 15, 2010 very good lisp thank you for your effort Quote Link to comment Share on other sites More sharing options...
alanjt Posted July 15, 2010 Share Posted July 15, 2010 Enjoy :wink: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.