Author Topic: setting scale and rotation upon insert?  (Read 8513 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
setting scale and rotation upon insert?
« 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

DEVITG

  • Bull Frog
  • Posts: 481
setting scale and rotation upon insert?
« Reply #1 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.
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
setting scale and rotation upon insert?
« Reply #2 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....
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

DEVITG

  • Bull Frog
  • Posts: 481
image do too.
« Reply #3 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.
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
setting scale and rotation upon insert?
« Reply #4 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)
  )
TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
setting scale and rotation upon insert?
« Reply #5 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)
  )
TheSwamp.org  (serving the CAD community since 2003)

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
setting scale and rotation upon insert?
« Reply #6 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")
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

ronjonp

  • Needs a day job
  • Posts: 7529
setting scale and rotation upon insert?
« Reply #7 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

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

DEVITG

  • Bull Frog
  • Posts: 481
setting scale and rotation upon insert?
« Reply #8 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 :)
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

ELOQUINTET

  • Guest
setting scale and rotation upon insert?
« Reply #9 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)
  )

ELOQUINTET

  • Guest
setting scale and rotation upon insert?
« Reply #10 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?

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
setting scale and rotation upon insert?
« Reply #11 on: March 08, 2004, 01:19:35 PM »
Don't use 14 Dan.
TheSwamp.org  (serving the CAD community since 2003)

ELOQUINTET

  • Guest
setting scale and rotation upon insert?
« Reply #12 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  :?:

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
setting scale and rotation upon insert?
« Reply #13 on: March 08, 2004, 02:16:24 PM »
what is the exact name of the file you are trying to insert?
TheSwamp.org  (serving the CAD community since 2003)

ELOQUINTET

  • Guest
setting scale and rotation upon insert?
« Reply #14 on: March 08, 2004, 02:41:25 PM »
A-430 for this example. it varies though

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
setting scale and rotation upon insert?
« Reply #15 on: March 08, 2004, 03:18:38 PM »
A-430.?
TheSwamp.org  (serving the CAD community since 2003)

ELOQUINTET

  • Guest
setting scale and rotation upon insert?
« Reply #16 on: March 08, 2004, 04:44:07 PM »
is that your answer mark or were you guessing what i'd say?

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
setting scale and rotation upon insert?
« Reply #17 on: March 08, 2004, 04:46:50 PM »
Does the A-430 have an extension? Like .tif of .tiff
TheSwamp.org  (serving the CAD community since 2003)

ELOQUINTET

  • Guest
setting scale and rotation upon insert?
« Reply #18 on: March 08, 2004, 04:48:42 PM »
yeah .tif sorry bout that

johnjoe

  • Guest
Helix Issue
« Reply #19 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:

ELOQUINTET

  • Guest
setting scale and rotation upon insert?
« Reply #20 on: March 24, 2004, 01:29:10 PM »
when posting a new post hit new thread not post a reply ok

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
setting scale and rotation upon insert?
« Reply #21 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!
TheSwamp.org  (serving the CAD community since 2003)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
setting scale and rotation upon insert?
« Reply #22 on: March 24, 2004, 02:01:52 PM »
johnjoe
Take a look Here
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
setting scale and rotation upon insert?
« Reply #23 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

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
setting scale and rotation upon insert?
« Reply #24 on: March 24, 2004, 03:37:37 PM »
I believe as long as you maintain the same path structure you'll be fine.
TheSwamp.org  (serving the CAD community since 2003)