Jump to content

DCL Compass Points Similar to DDVPOINT


David Bethel

Recommended Posts

Greetings,

 

Has anyone ever made a DCL similar to DDVPOINT X Axis inputs?

 

I'm trying to select only the 16 compass points ( 22.5 degree ). The DCL radio button screen is really bad. The graphics view would be much better.

 

I've started to break down DDVPOINT.lsp but I've never used the image tile before. -David

COMP-DCL.jpg

DDDIR.GIF

DDDIRSLD.ZIP

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

I think you want the $Y $X call backs from the action_tile. This along with the dim_y and dim_x values will determine where you selected in the image_button.

 

I do have an example somewhere, if I find it I'll post it.

Link to comment
Share on other sites

Greetings,

 

Has anyone ever made a DCL similar to DDVPOINT X Axis inputs?

 

I'm trying to select only the 16 compass points ( 22.5 degree ). The DCL radio button screen is really bad. The graphics view would be much better.

 

I've started to break down DDVPOINT.lsp but I've never used the image tile before. -David

 

 

Hey David,

 

I would use vector_image to accomplish this. Check out my OLC program as an example. The mimage2.lsp was used to create the image. You could do the same thing with a slide button and make the image highlight or use a popup list.

OLCv5.zip

Mimage2.lsp

Link to comment
Share on other sites

Thanks for the replies. I'll try the tutorial as seems to have the basics. -David

 

David,

 

Give the program below a try. I redrew your slide and placed it in its own dcl.

 

If this is what you are looking for, I will be glad to give you all the specifics.

This was created with the mimage2.lsp I posted.

External slides are not required because they are built-in to the code.

The mimage2.lsp will write the lisp code for the image as well as the dcl code for you.

There are some additional steps that need to be taken, But I can get you thru all that.

 

Note: The more complex the image the larger the code will be.

 

If you need an image button to work exactly as the DDVPOINT.lsp, Then proceed with the tutorial.

 

Just let me know.

COMPASS.zip

Document1.JPG

Document2.JPG

Link to comment
Share on other sites

Buzzard,

 

Thanks! I didn't know that images could be generated via the lsp routine. I was looking more to the ddvpoint input of pointing to direction in image tile and it returning the direction angle or compass value. Your's will be a good learning for me.

 

Thanks again! -David

Link to comment
Share on other sites

Buzzard,

 

Thanks! I didn't know that images could be generated via the lsp routine. I was looking more to the ddvpoint input of pointing to direction in image tile and it returning the direction angle or compass value. Your's will be a good learning for me.

 

Thanks again! -David

 

I glad you like it.

 

Technically the image is a Windows Metafile.

 

I am sure you could make something like this work for you in your program.

 

Just to mention the mimage2.lsp was created by Viper from the Exchange Forum. I have been using this program for all my slides and never went back to making external slides again.

 

It works sort of the same manner a script would with exception that you need to control the movement of the pointer thru the popup list. The image you provided was redrawn and made into a slide with the program and used as a background image. I created a pointer and made an image for each movement (22.5 degrees) and placed it in a conditional to operate with the popup list. Care needs to be taken so that there is no shifting in the view that you create all this. I make a saved view just in case of any accidental shifting. This ensures clean movement of the pointer.

 

When running the mimage2.lsp it will create two files. vimage.dcl & vimage.lsp and place them in a TEMP directory on C: drive. I just remove the lists and place them in my program. You would need to experiment with the frame size to get the size slide you want. The above compass slide used a dimx_tile value 300 x dimy_tile 295. I used a black background for the compass and no background for the pointer. If you decide not to use any background color and want to us the dialogs gray background, You will need to make sure your slide is made with darker colors to stand out.

 

This is the same method that is used for most of acads images that are in dialogs. Example: The dimension style manager which changes when you select different options and the ddvpoint dialog also. Take note that the text used in those dialogs are standard fonts. The reason for this is to keep the lists smaller. When ever you use a font with more curve or use any circles you can expect the lists to be large. I also want to point out that solids do not work well as the fill becomes sort of empty. In this case I used a hatch pattern for the pointer to give it that filled look.

 

Just think about it, When you compile your program to vlx, The slides are now included. Real Neat!

 

I hope this gives you an idea what its all about. I will be happy to answer any questions you have about it.

 

Good Luck,

The Buzzard

Link to comment
Share on other sites

So far, I'm unimpressed with the tutorial. Too many dependency calls labeled ;included. My $0.02 -David

 

I did not like it either. Terry writes programs for a living. My guess is he wants to make sure it looks difficult so you would need to depend on his abilities. It seems the tutorial needs all the programs listed in order to work correctly. From there you would need to find out what belongs to what.

 

I know when you use the program as he has outlined, It works pretty good.

As far as I know, I have not seen to many examples for clicking onto a slide other than that example.

 

Sorry about that David

Link to comment
Share on other sites

David,

 

Here is the complete program for MyDialogs.

It contains MyDialogs.dcl & MyDialogs.lsp

After loading type MY

Select My Image Button in the list on the right.

The correct dialog should appear with the Slide Button.

Click onto the positions shown on the dialog and the image will change.

 

Note that the images were created with another program similar to the one I posted. The program I posted I feel is much better.

These images are created with Vector Image as I have pointed out.

Maybe with the complete program you can get this sorted out.

 

I hope this will help,

Good Luck

MyDialogs.zip

Link to comment
Share on other sites

Ok David,

 

I went thru the MyDialogs program and broke it all down to only what is needed to run that part of the program you are concerned with.

 

Attached is My.dcl & My.lsp. Just type My to start.

You now have less programming to view to see what makes this work.

I also noticed where vector_text is called, You can comment that part out if you do not really need to be bothered with that or use the My2.lsp & My2.dcL. That function I removed and the program works the same without the vector_text.

Just type My2 to start.

 

I find this somewhat interesting myself. I want to see if I can apply the same method to the Compass.lsp.

 

I hope we are not both over our heads in this, But its worth a try.

My.zip

My2.zip

Link to comment
Share on other sites

I think that the big difference is that DDVPOINT uses a static the background slide image and then adds the white direction vector line. It doesn't seem to redraw the entire image with every click. That seems to make sense to me. I just haven't figured out how they do it yet. -David

Link to comment
Share on other sites

I think that the big difference is that DDVPOINT uses a static the background slide image and then adds the white direction vector line. It doesn't seem to redraw the entire image with every click. That seems to make sense to me. I just haven't figured out how they do it yet. -David

 

 

Thats how I did it in the COMPASS.lsp, But because this is an Image Button and your image always stays the same with exception to the indicator, It could be set the same way as mine. The function call would only need to provide the indicator going in its proper direction. My Compass.lsp uses a conditional because I am operating it with a popup list and this would not be useful in this situation. The function call is the way to go.

 

The following code provides the coordinates for the image to change in five directions. You would need to change this to calculate 16 points along a circumference. When the cursor is placed on a coordinate and clicked it would trigger to go to its respected function showing the pointer image to match. So you would need 16 pointer functions in addition to this.

 

 

;-------------------------------------------------------------------------------
; c:My2
; These images were created using GetVectors.lsp on AutoLISP Exchange
; (URL: [url]http://web2.airmail.net/terrycad[/url])
;-------------------------------------------------------------------------------
(defun c:My2 (/ Dcl_Id% Show_Image:)
 (princ "\nMyImageButton")(princ)
 ; Show_Image: ----------------------------------------------------------------
 (defun Show_Image: (/ Ang CenPt Dist~ PickPt X# Y#)
   (start_image "Image1")
   (setq X# (dimx_tile "Image1"))
   (setq Y# (dimy_tile "Image1"))
   (end_image)
   (setq CenPt  (list (/ X# 2)(/ Y# 2))
         PickPt (list $x $y)
         Ang    (angle CenPt PickPt)
         Dist~  (distance CenPt PickPt)
   )                                     ;setq
   (cond
     ((< Dist~ (/ Y# 4))   (Front_View)) ;*Included
     ((< Ang   (* pi 0.25))(Right_View)) ;*Included
     ((< Ang   (* pi 0.75))(Bottom_View));*Included
     ((< Ang   (* pi 1.25))(Left_View))  ;*Included
     ((< Ang   (* pi 1.75))(Top_View))   ;*Included
     (t (Right_View))
   )                                     ;cond
 )                                       ;defun Show_Image:
 ;-----------------------------------------------------------------------------
 ; Load Dialog
 (setq Dcl_Id% (load_dialog "My2.dcl"))
 (new_dialog "MyImageButton" Dcl_Id%)
 ; Set Dialog Initial Settings
 (set_tile "Title" " My Image Button")
 (set_tile "Text1" "Pick arrows to change views.")
 (Front_View);*Included
 ; Dialog Actions
 (action_tile "Image1" "(Show_Image:)")
 (start_dialog)
 ; Unload Dialog
 (unload_dialog Dcl_Id%)
 (princ)
);defun c:MyImageButton
;-------------------------------------------------------------------------------

Link to comment
Share on other sites

I'm getting there slooooooooowwwwwly. Not really. DDVPOINT has a lot to digest. Still can't get the input or vector. -David

 

David,

 

I am getting problems also with the input as well. I am not sure how to apply it to circular coordinates.

Link to comment
Share on other sites

Buzzard,

 

Here is how is draws the vector:

 

(defun ai_ddvp_drx (ang x1 col / a x2 y2)
 (setq a (polar (list 0.0 0.0) 
                (- (* 2.0 pi) (ai_dtr ang)) 
                33.0
         )
       x2 (+ x1 (fix (car a)))
       y2 (+ ai_ddvp_by (fix (cadr a)))
 )
 (start_image "ddvp_image")
 (vector_image x1 ai_ddvp_by x2 y2 col)
 (end_image)
)

 

 

Looks like angle x_point color. -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

comp2.zip

Link to comment
Share on other sites

To get the size of the tile you need to use

 

(dimx_tile key); Retrieves the width of a tile in dialog box units

(dimy_tile key); Retrieves the height of a tile in dialog box units

 

; The key argument is case-sensitive.

 

The will give you the size of the image button then calculate your center from them.

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...