TheSwamp

CAD Forums => CAD General => Topic started by: ELOQUINTET on March 02, 2004, 06:38:08 PM

Title: setting scale and rotation upon insert?
Post by: ELOQUINTET on March 02, 2004, 06:38:08 PM
i have this macro and i am trying to fix the scale and rotation. i want my image to be inserted with a scale of 7.9036 and with a rotation of -90. how would i modify my macro to acheive this?

(command "-layer" "n" "0-IMAGE" "c" "WHITE" "0-IMAGE" ) ;setvar clayer "0-IMAGE";_imageattach
Title: setting scale and rotation upon insert?
Post by: DEVITG on March 05, 2004, 06:45:59 PM
seem to be that _imageattach allways invoke the dialog box.

I do not know if there is a way to avoid the dialog box to show off.
Title: setting scale and rotation upon insert?
Post by: Keith™ on March 05, 2004, 08:53:15 PM
You cannot use imageattach in this scenario you should use image....
Now to get the rest of the command parameters passed, you will need to..

1) Call image with a lisp function in your button... i.e. (command "image" ......)
2) Determine what the order of operation is for the image command. I don't use image (or imageattach for that matter) so right off the top of my head I cannot tell you.
3) Probably right after the attach command is issued,  you will need to specify insertion points and scales... you can use \ to pause (i think) and then hard code the scale...

Something like this ...

(command "image" "a") ;\ 90 7.9036

You will probably have to tweak it since I have not tested it....
Title: image do too.
Post by: DEVITG on March 06, 2004, 07:49:44 AM
image invoke the dialog box too, a diferente but a dialog .

The trick would be how to tell acad not to show te dialog and acept command line input.

I had tryed all way , changing attdia , ccmddia, and cmdactive, Iset it to 0
but it still show the dialog box.
Title: setting scale and rotation upon insert?
Post by: Mark on March 07, 2004, 09:17:35 AM
Here ya Dan.
Code: [Select]

(defun get-mspace ()
 (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))
 )

(defun get-img-file ()
  (getfiled "Browse for Image file: " "" "" 8)
  )

(defun c:img-insert (/ ms imgfile ins-pt image-obj)
  (setq ms (get-mspace)); modelspace object

  (if (setq imgfile (get-img-file))
    (if (setq ins-pt (getpoint "\nInsertion Point: "))
      (setq image-obj
             (vla-AddRaster ms
               imgfile
               (vlax-3D-point ins-pt)
               7.9036
               (* pi 1.50)
               )
            )
      )
    )
  (if image-obj
    (if (not (vlax-object-released-p image-obj))
      (vlax-release-object image-obj)
      )
    )
  (princ)
  )
Title: setting scale and rotation upon insert?
Post by: Mark on March 07, 2004, 09:34:28 AM
Forgot the layer part!
Code: [Select]

(defun get-mspace ()
 (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))
 )

(defun get-img-file ()
  (getfiled "Browse for Image file: " "" "" 8)
  )

(defun c:img-insert (/ ms imgfile ins-pt image-obj)

  (command "layer" "make" "0-IMAGE" "color" 7 "" "")
 
  (setq ms (get-mspace)); modelspace object

  (if (setq imgfile (get-img-file))
    (if (setq ins-pt (getpoint "\nInsertion Point: "))
      (setq image-obj
             (vla-AddRaster ms
               imgfile
               (vlax-3D-point ins-pt)
               7.9036
               (* pi 1.50)
               )
            )
      )
    )
  (if image-obj
    (if (not (vlax-object-released-p image-obj))
      (vlax-release-object image-obj)
      )
    )
  (princ)
  )
Title: setting scale and rotation upon insert?
Post by: Keith™ on March 07, 2004, 02:56:29 PM
I have had a bit of time to peruse this...
This works as well...
Code: [Select]

(command "image" "a" "imagename" pause "7.9036" "-90")


If you need to browse for the image, use....
Code: [Select]

(command "image" "a" (getfiled "Image to insert" "" "jpg" 8) pause "7.9036" "-90")
Title: setting scale and rotation upon insert?
Post by: ronjonp on March 07, 2004, 04:51:33 PM
Quote
I had tryed all way , changing attdia , ccmddia, and cmdactive, Iset it to 0
but it still show the dialog box.


If you use the command -image and set filedia to 0 the dialogue doesn't pop-up.

Ron  :D
Title: setting scale and rotation upon insert?
Post by: DEVITG on March 07, 2004, 05:23:08 PM
Hi Ronjop, I forget that the image was a file, and I did not consider the filedia as the variable to change. :oops:
Thanks for it :)
Title: setting scale and rotation upon insert?
Post by: ELOQUINTET on March 08, 2004, 01:10:37 PM
hey mark i was using what i asked for for jpgs at home but i am trying to adapt your lisp to tiff files here at work. i figured out that to change the file type to browse for i had to change the 8 to 14. it's working but my question is why would it be assigning an anonymous name "OAImg1082920496" to it rather than the actual name of the scan "a-430"? here's what i have:


Code: [Select]
(defun get-mspace ()
 (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))
 )

(defun get-img-file ()
  (getfiled "Browse for Image file: " "" "" 14)
  )

(defun c:I12 (/ ms imgfile ins-pt image-obj)

  (command "layer" "make" "0-IMAGE" "color" 7 "" "")
 
  (setq ms (get-mspace)); modelspace object

  (if (setq imgfile (get-img-file))
    (if (setq ins-pt (getpoint "\nInsertion Point: "))
      (setq image-obj
             (vla-AddRaster ms
               imgfile
               (vlax-3D-point ins-pt)
               387.25
               (* pi 1.50)
               )
            )
      )
    )
  (if image-obj
    (if (not (vlax-object-released-p image-obj))
      (vlax-release-object image-obj)
      )
    )
  (princ)
  )
Title: setting scale and rotation upon insert?
Post by: ELOQUINTET on March 08, 2004, 01:17:02 PM
it's not a big deal i was just wondering if it's an easy fix or no?
Title: setting scale and rotation upon insert?
Post by: Mark on March 08, 2004, 01:19:35 PM
Don't use 14 Dan.
Title: setting scale and rotation upon insert?
Post by: ELOQUINTET on March 08, 2004, 01:32:46 PM
ok changed it back to 8. for some reason when i had it as 8 before when i browsed it wasn't showing any tiffs so i thought this would fix that. now they are showing up with the 8, who knows? it's still giving the image a funky name and i can't see where it does that  :?:
Title: setting scale and rotation upon insert?
Post by: Mark on March 08, 2004, 02:16:24 PM
what is the exact name of the file you are trying to insert?
Title: setting scale and rotation upon insert?
Post by: ELOQUINTET on March 08, 2004, 02:41:25 PM
A-430 for this example. it varies though
Title: setting scale and rotation upon insert?
Post by: Mark on March 08, 2004, 03:18:38 PM
A-430.?
Title: setting scale and rotation upon insert?
Post by: ELOQUINTET on March 08, 2004, 04:44:07 PM
is that your answer mark or were you guessing what i'd say?
Title: setting scale and rotation upon insert?
Post by: Mark on March 08, 2004, 04:46:50 PM
Does the A-430 have an extension? Like .tif of .tiff
Title: setting scale and rotation upon insert?
Post by: ELOQUINTET on March 08, 2004, 04:48:42 PM
yeah .tif sorry bout that
Title: Helix Issue
Post by: johnjoe on March 24, 2004, 12:57:13 PM
HI,

Im having a problem extruding a non-circular shape around a helix. The shape I need to extrude is rectangular. Whenever I extrude a rectangle around a polyline helix (into solid form) the rectangle gets twisted. The rectangle starts off perpendicular to the axis of the helix and ends up twisted at an angle. I checked a number of furums and noticed other people had problems with helix's. Perhaps Autocad can't do this. If this is the case, is there a relatively easy way aound this. I'd like to point out that I'm not interested in extruding a circle. Id apreciate some feedback on this,

Thanks

 :shock:
Title: setting scale and rotation upon insert?
Post by: ELOQUINTET on March 24, 2004, 01:29:10 PM
when posting a new post hit new thread not post a reply ok
Title: setting scale and rotation upon insert?
Post by: Mark on March 24, 2004, 01:44:40 PM
Dan, did you ever get that little program to work for your .tif files? It works for me just fine!
Title: setting scale and rotation upon insert?
Post by: CAB on March 24, 2004, 02:01:52 PM
johnjoe
Take a look Here (http://theswamp.org/phpBB2/viewtopic.php?t=1147)
Title: setting scale and rotation upon insert?
Post by: ELOQUINTET on March 24, 2004, 03:16:05 PM
ummm no mark its still giving it a dummmy name. i was mainly using it for something i'm doing at home so its not such a big deal. i have a huge video collection and am making inserts for my video cases. some i already have a volume and when i scan and insert it to use as a template for volume 2 i don't want to have to input the info. it would be nice because i considering zipping and burning them to disc. have you burned drawings with images to disc. is there a problem with it losing the path. i have everything in the same folder which i will burn. anyway that's the status report thanks for askin  :P
Title: setting scale and rotation upon insert?
Post by: Mark on March 24, 2004, 03:37:37 PM
I believe as long as you maintain the same path structure you'll be fine.