Jump to content

DCL Compass Points Similar to DDVPOINT


David Bethel

Recommended Posts

Tim,

 

That's what I understood. I'm having problems getting the center of the image to align with the center of the image_button. It must have to do with the width / height attributes in the dcl image_button call. -David

Link to comment
Share on other sites

  • Replies 102
  • Created
  • Last Reply

Top Posters In This Topic

  • The Buzzard

    54

  • David Bethel

    30

  • Lee Mac

    11

  • TimSpangler

    8

Another thing that I don't understand. It looks like dimx_tile returns pixels. What type of value does the image_button width attribute look for? -David

Link to comment
Share on other sites

If i am not mistaken the values of the image_button are system dependent.

 

I remember reading something about using a ratio for image button when creating vector images. Anyway when I changed your code to this:

 

dcl_settings : default_dcl_settings { audit_level = 0; }
comp : dialog { label = "Compass Inputs";

: row {
 : image_button {
   key = "Image1";
   alignment = centered;
   width = 50 ;
   aspect_ratio = 0.98;
   color = -2;
 }
}
: row { ok_button ;
       cancel_button ; }
}

 

it seems to work fine. It looks as thought your vector image is over drawing your image button. I just keep playing with the size attribute in the dcl until it looks right.

 

I'll try to find the ratio code for vector graphics and post it here.

Link to comment
Share on other sites

It is in the MyDialogs by Terry Miller "dclcalcs"

 

;-------------------------------------------------------------------------------
; PixelsToHeight - Converts pixels to height as a string or number
; Arguments: 1
;   Pixels = String or integer of pixels
; Returns: Height as a string or a number
;-------------------------------------------------------------------------------
(defun PixelsToHeight (Pixels / Height String)
 (if (= (type Pixels) 'STR)
   (setq String t Pixels (atoi Pixels))
 );if
 (if (< Pixels 1)(setq Pixels 1))
 (setq Height (atof (rtos (+ (* (1- Pixels)(/ 1 13.0)) 0.048) 2 2)))
 (if String (setq Height (rtos Height 2 2)))
 Height
);defun PixelsToHeight

 

and

;-------------------------------------------------------------------------------
; PixelsToWidth - Converts pixels to width as a string or number
; Arguments: 1
;   Pixels = String or integer of pixels
; Returns: Width as a string or a number
;-------------------------------------------------------------------------------
(defun PixelsToWidth (Pixels / String Width)
 (if (= (type Pixels) 'STR)
   (setq String t Pixels (atoi Pixels))
 );if
 (if (< Pixels 1) (setq Pixels 1))
 (setq Width (atof (rtos (+ (* (1- Pixels) (/ 1 6.0)) 0.09) 2 2)))
 (if String (setq Width (rtos Width 2 2)))
 Width
)

 

All by Terry Miller.

Link to comment
Share on other sites

Tim,

 

That's what I understood. I'm having problems getting the center of the image to align with the center of the image_button. It must have to do with the width / height attributes in the dcl image_button call. -David

 

David,

 

Here is the button used in Terry's dcl with the new figures for the image I made.

 

  : image_button {
   key = "Image1";
   width = 49.92;
   height = 22.66;
   fixed_width = true;
   fixed_height = true;
   aspect_ratio = 1;
   color = -2;
 }

 

 

This will center your image in the tile.

When I created the vector image for the Compass.lsp I used 300 for the dimx by 295 for the dimy.

If you want to make the tile smaller another image would need to be created.

Link to comment
Share on other sites

Just to mention, When I run the mimage2.lsp to make the image the program makes a lsp and dcl. I use the information supplied in the dcl in my own dcl to get the correct tile size.

 

Refer to post 8.

 

To help a bit further I am attaching the drawing used to make the image. It has a view saved as Compass incase of accidental window shifting.

There are 3 layers to control what part of the image that is needed. I am sure you have your own drawing you wish to use, But since this drawing has been used for the examples I will supply it to you to experiment with. It is saved back to 2007 format.

Compass.dwg

Link to comment
Share on other sites

It is in the MyDialogs by Terry Miller "dclcalcs"

 

;-------------------------------------------------------------------------------
; PixelsToHeight - Converts pixels to height as a string or number
; Arguments: 1

 

All by Terry Miller.

 

Thanks for the reply. That sure seems like a weird calculation for sizes..... I wonder where he came up with that?

 

I'm getting close to getting things centered up on the slide image. One that is throwing things off a bit is the return of dimx_tile & dimy_tile.

 

The coordinates returned are the maximum allowed within the tile. Because coordinates are zero based, this functions return one less than the total X dimension (X–1).

 

DDVPOINT subtracts 1 from the value for it's call

  (start_image "ddvp_image")
 (slide_image
   0 0
   (- (setq image_x (dimx_tile "ddvp_image")) 1) 
   (- (setq image_y (dimy_tile "ddvp_image")) 1)
   "acad(ddvp3d)"
 )
 (end_image)

 

Buzzard, I see how you came up with those number now.

 

-David

Link to comment
Share on other sites

Ok,

 

 

 

 

 

Got some of it figured out:


  • $x & $y are returned automatically
    You cannot overlay vector images
    You must include the direction vector in the new image

 

What I haven't figured out:


  • How the size of image is calculated
    How to align the center of image_button and the center of the image
    Why is every thing 180 degrees out ( I used (- (* pi 2) ...

-David

 

 

David,

 

I just caught this post. The part about not being able to overlay another image is not completely true. I just want to clarify.

On the Compass lisp I use one static image of the compass and overlay the pointer showing movement with a conditional. When creating the pointer with the mimage2.lsp no background is selected so all you are imaging is only the pointer and nothing else. I hope I am not misinterpreting you. If you open the Compass lisp and go to the COM_UFI function you will see where I start the image. The end image is at the end of the conditional or at the end of the function.

 

If you think about it, Thats 2 images in 1 start to end image call.

 

On the other hand, Since an image button is being used in this case, The idea about one static image being used here may not seem possible. You may have to repeat the compass image with it pointer going in the right direction for each 16 positions. In this case you may have no choice but to have redundant images to complete this task since with each selection a frame change is required.

Link to comment
Share on other sites

Buzzard,

 

I thought that you redefined "iMG" each time the input changed. What I was referring to is that I have not found a way the display the background and then overlay another entire image ( the direction line ) over the background. I think the complete image must be defined and then displayed each time.

 

I foresaw this as a tough one and it has turned into a even more complicated project than I anticipated. I'll keep plugging at it. Thanks for all of your help! -David

 

PS I have the Y axis dead on. X is still off

comp3.jpg

Link to comment
Share on other sites

Buzzard,

I thought that you redefined "iMG" each time the input changed. What I was referring to is that I have not found a way the display the background and then overlay another entire image ( the direction line ) over the background. I think the complete image must be defined and then displayed each time.

 

I foresaw this as a tough one and it has turned into a even more complicated project than I anticipated. I'll keep plugging at it. Thanks for all of your help! -David

 

PS I have the Y axis dead on. X is still off

 

I agree with you on that.

 

I know what you mean, But as I have mentioned because this is an Image Button and when clicked starts a function to show an entirely new image. Terrys program changes frames showing a new image with each click. We cannot use one static image as previously thought. You can combine the compass image with the pointer included. You need to show the pointer in a different direction for each image with respect to its correct function call. The only problem I have been having with this is how to provide the correct calculations for the pick points on the image tile. Once we can get past this, Its all down hill.

I do not have any experience with this type of operation, But I have plenty with regard to vector image. I am trying to use a trial and error approach with the hope I will hit onto something. I wish I could provide you with better details on this, But as you can see we are both blindfolded with this method.

 

The My.lsp or My2.lsp better yet has all you need to accomplish this with exception to the proper calculations. We need to concentrate on this part of the programming if we are to move forward from here.

Link to comment
Share on other sites

Getting closer:


    Add 1 pixel on the x axis for the dimx_tile call
    Add 1 pixel on the x axis for the rounding down ACAD does
    Found the exact aspect ratio of the screen when the slide was made
    Increase the inner circle diameter
    Decreased the direction vector length
    (this way your eyes can't compare the direction vector and compass lines to the nth degree)

 

-David

comp4.jpg

COMP4.ZIP

Link to comment
Share on other sites

Getting closer:

  • Add 1 pixel on the x axis for the dimx_tile call
    Add 1 pixel on the x axis for the rounding down ACAD does
    Found the exact aspect ratio of the screen when the slide was made
    Increase the inner circle diameter
    Decreased the direction vector length
    (this way your eyes can't compare the direction vector and compass lines to the nth degree)

-David

 

David,

 

Just out of curiosity, Are you using the mimage2.lsp? And if so, Are you running into any problems that I can help you with there?

Link to comment
Share on other sites

Thats great David,

 

It operates smooth.

And I see you are using a conventional slide for this.

So that answers my question.

 

Great work!

Link to comment
Share on other sites

Buzzard,

 

I did try the mimage. The over length lines is a real pain. ? Does the last value include the next character or is it a space. Maybe notepad++ will interpret it correctly. -David

Link to comment
Share on other sites

Buzzard,

 

I did try the mimage. The over length lines is a real pain. ? Does the last value include the next character or is it a space. Maybe notepad++ will interpret it correctly. -David

 

Not exactly sure what you mean, The prompts are as follows:

 

After you load the program type MIMAGE2 at the command prompt.

You will then get the following prompts, You should try them out with different settings to see how they work.

 

1. Enter dimx_tile :

2. Enter dimy_tile :

3. Are the image objects inside the red outline? :

4. Do you want an image background? [Yes/No] :

 

When all the prompts are answered,

It then shows you the dialog with the slide you created.

These files are stored in the Temp directory on C: drive.

They are called VIMAGE.lsp & VIMAGE.dcl

 

You can copy your lists from the lisp file & dcl settings from the dcl file.

 

I have never had any problems with them. Again I suggest you experiment with it to get the feel for it.

Link to comment
Share on other sites

Buzzard,

 

What I was talking about is an old ASCII editor breaks an over length line at the 1,000th character, regardless whether it is a space or in the middle of a word or number. So trying place a CR at the proper place is a bit of guess work. I'll try a newer editor to see if word wraps to the screen and then I can add the CRs. -David

Link to comment
Share on other sites

Buzzard,

 

What I was talking about is an old ASCII editor breaks an over length line at the 1,000th character, regardless whether it is a space or in the middle of a word or number. So trying place a CR at the proper place is a bit of guess work. I'll try a newer editor to see if word wraps to the screen and then I can add the CRs. -David

 

I see, I just use the VLIDE editor most times and allow it to format the code. I normally just copy the lists from the code to use in my program. In time I have just got use to it I guess, But overall I never saw this as a problem.

 

Terry has a program that works similar, But is more involved and difficult to work with.

What you seem to have done upto this point is great. I think it would be much better if the images were added to the code, But as I say it a matter of testing the program with different settings and more important keeping the images as simple as possible to keep the lists smaller.

 

With all the programs I needed images for, Its nice not to have them loose outside the code. It just a matter of preference I guess.

Link to comment
Share on other sites

Never mind,

 

I tried something different, But it was not that good.

So I went back to the original idea.

Anyway here is Comp6.lsp & Comp6.dcl.

It has vector image of the compass.

Not real good, But Ok.

The colors are a bit distorted.

I will need to figure that one out.

Give it a test. It needs a little bit of work.

COMP6.zip

Link to comment
Share on other sites

Buzzard,

 

COMP6.DCL wasn't included in the zip.

 

The last atom of the vector_image list changes the color.

 

Look like the only time ACAD uses vector_images is to either draw a box around a tile and the point in DDVPOINT. I don't think that they imagined it to draw entire images. Not that it can't, just wasn't the initial concept. Too bad mimage doesn't do the line breaks. -David

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...