Author Topic: Standard DCL question?  (Read 31102 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12904
  • London, England
Re: Standard DCL question?
« Reply #15 on: May 12, 2012, 02:04:14 PM »
You're very welcome KewlToyZ, I hope you can benefit from the example  :-)

As you've probably gathered, in my example I have only programmed the interface for you and haven't touched the business end of the program. I shall take a look at the methods you are using in your existing program and see if I can offer any suggestions.

KewlToyZ

  • Guest
Re: Standard DCL question?
« Reply #16 on: May 12, 2012, 02:33:01 PM »
Wow thanks Lee, Make me work for it though kind sir.  :laugh:
I didn't expect a response anytime soon. Your help and ability is truly appreciated.
I am taking my girl friend out to celebrate her completion of her first year at Georgetown Law today.
I just woke up in the middle of the night trying to figure out how to do this program.
I got something sort of working, and you presented a really worthwhile interface. I thank you.

I need to break through the wall in my own head that keeps me from getting a clearer picture with these tasks and the methods for approaching the code progression.
I have some people that ask me for the interface I used to maintain. The previous company did away with the interface entirely after I left. And everyone that used it and worked with me has left too. Now it has become a hobby.
So I periodically pick this thing up and try to noodle around with cleaning up legacy items unnecessary anymore.  I'm not selling anything. I just get paid for doing project setups between engineers and architects on the side. As I said it's more of a hobby anymore.

I wanted to eliminate vb from the app completely and make the maintenance requirements no more demanding than having AutoCAD and a text editor. Between web design and this AutoCAD interface these were really the only programming environments that I actually liked and enjoyed looking at with minimal tools.

I had a thing for ASP.NET and Web Matrix but Visual Studio became such a nightmare to maintain connectivity with and the version changes since 1.1 left me in the dust. I like coming back to something basic in terms of tools like this to learn from and use.

I got to say that solution you made is beautiful!
« Last Edit: May 12, 2012, 02:47:10 PM by KewlToyZ »

KewlToyZ

  • Guest
Re: Standard DCL question?
« Reply #17 on: May 14, 2012, 02:59:51 PM »
Looking through your interface, and how things worked from my mess of pieces parts,
I'm inclined to save the values from the DCL tiles and execute the scale addition of what is selected to the drawing rather than add all and then select. I'm stepping through it to add the tile values from t1, t2, t3, t4 each to a setq and fire off setvar and commands accordingly.

KewlToyZ

  • Guest
Re: Standard DCL question?
« Reply #18 on: May 15, 2012, 05:59:08 AM »
While working with these, I'm running into a few things I am seriously lacking.
The first item I ran into; I will need two versions of this.
When I use this with a view port setup routine, the vb version lets me set the view port scale.
The DCL version I am not catching the timing properly and I cannot fire a cannoscale setting from the layout tab without selecting the view port I have just created first. I'm going to go back and see if I am missing an environment call that let me get away with it before.

The second thing I am running into trouble with; I am missing a step in gathering the data from the DCL and applying it.
I look through the code you supplied Lee, I see where you formatted the data for each tile value in the _updatetext function.
Grabbing that snapshot at the proper time is where I am running into a problem and I am guessing I am wrong in my assumption that I can just capture each one as a string to reuse?
I added action tiles for the OK & Cancel buttons and applied a function to simply print those values when I click OK but I error out when I click OK.
The first line I try to print is the scale line and the format I have returned tells me:
Error: bad argument type: FILE "1/8\" = 1'-0\""

I haven't figured out where I missed a call to FILE?

KewlToyZ

  • Guest
Re: Standard DCL question?
« Reply #19 on: May 15, 2012, 07:13:22 AM »
Essentially what I use for my View Port setup routine is this:

Code: [Select]
(defun c:vpt()
;=============================================================================Turn off command line responses
(command "CMDECHO" 0);DO NOT CHANGE THIS LINE
;=============================================================================

(setq userlayer (getvar "clayer"))
(setq ds2 (getvar "dimscale"))
(setq userview (getvar "ctab"))
(setq myTile (getvar "TILEMODE"))

;(> <NUMB1> <NUMB2>)                      Returns T if <NUMB1>is greater than <NUMB2>.
(if (> 0 myTile)
(prompt "\n   Switching view tab......")
(command "tilemode" 0)
)

(command "-layer" "Make" "G-VIEW-PORT" "Color" "Red" "G-VIEW-PORT" "Plot" "No" "G-VIEW-PORT" "Set" "G-VIEW-PORT" "")

(autoload "setviewscale" '("setviewscale"))
(c:setviewscale)

(princ "\n")
(command "osmode" "523")
(princ "\n")
(command "mview")
(princ "\n")
(command (setq p1 (getpoint "\n   Select first corner of window opening: ")))
(prompt "\n ")
(command (getcorner p1 "\n   Select opposite corner of window opening: "))
(prompt "\n ")
(command "mspace")
(princ "\n")
(command "zoom" "e")
(princ "\n")
(command "zoom" "c")
(princ "\n")
(command (getpoint "\n   Select center of view:"))
(princ "\n")
(command (strcat "1/" (rtos (getvar "dimscale") 2 0) "xp"))
(princ "\n")
    (command "pspace")
    (princ "\n")
(setvar "psltscale" 0)
(princ "\n")
(prompt "\n   DIMSCALE returning to original setting. ")
(princ "\n")
(setvar "dimscale" ds2)

;=============================================================================Turn off command line responses
(command "CMDECHO" 1);DO NOT CHANGE THIS LINE
;=============================================================================
(prompt "\n   Returning view and layer.....")
(command "ctab" userview)
(command "clayer" userlayer)
(prompt "\n   View and layer returned!")
(princ)
)

KewlToyZ

  • Guest
Re: Standard DCL question?
« Reply #20 on: May 15, 2012, 07:37:08 AM »
I don't want a finished solution.
I just need to be told where my mistakes are and directed toward approaching the solution.
 :ugly:

Lee Mac

  • Seagull
  • Posts: 12904
  • London, England
Re: Standard DCL question?
« Reply #21 on: May 15, 2012, 10:55:11 AM »
Hi KewlToyz,

Just to let you know that I am not ignoring this thread, but haven't had a chance to take a look at the program as yet.

I thank you for your compliments for the program  :-)

Lee

KewlToyZ

  • Guest
Re: Standard DCL question?
« Reply #22 on: May 15, 2012, 11:27:05 AM »
No worries Mr. Lee  :kewl:

I was reading through your web site, trying to understand what I can and lookup what I don't know.
You are a seriously busy guy.
A lot of the code in this interface you made really goes beyond what I understand.
Mainly in how you made the DCL actively update.
At what point am I actively able to access values.
What format I am actually getting versus what I need.
I'm going through trying to figure out each component and how it progresses towards the next.
I did not think replacing vb with dcl was going to be this complicated, but I wanted to know.
So I am trying to get my head around this. I appreciate the lessons.

I am catching a few reasons why my view port routine didn't work just testing my lame dcl routine, I was not actively updating the dimscale, and I was not in mspace when invoking the command. So I am working that out somewhat.
« Last Edit: May 15, 2012, 12:04:29 PM by KewlToyZ »

Lee Mac

  • Seagull
  • Posts: 12904
  • London, England
Re: Standard DCL question?
« Reply #23 on: May 15, 2012, 01:52:35 PM »
Hi KewlToyZ,

I spent a bit of time looking over your modifcations to the original 'scale.lsp' and 'scale.dcl' files and I can see what you were trying to achieve - you were receiving the 'FILE' error because you were supplying the princ function with essentially two string parameters, rather than using strcat to concatenate these strings to a single string to be printed, hence the princ function was assuming the second string was the file argument, resulting in an error.

Anyway, to make things clearer for you, I took some time this evening to go through the original files and comment / explain each line in turn (hopefully somewhat clearly) so that you can get a better picture of what is going on at each stage of the program (I typed it rather quick, so there may be typo's!). I have also tweaked the DCL definition as I see that you preferred to use columns over rows, so that everything should now line up a little more cleanly. You can find both of the updated files attached in this post for your perusal; if you have any questions about my comments, or need a section explained in more detail or in a different direction, just ask and I'll try my best to put something together for you. By the way, when studying the program files, ensure you are using the VLIDE (or another code editor, such as Notepad++, so that the comments are easily distinguishable from the code).

I hope that you found my website beneficial to your learning; unfortunately there aren't too many tutorials on there at the moment, since tutorials take a ton of time to plan, design, structure and write, so I have only gotten around to writing a few of them covering the topics that I feel are most frequently asked / most useful. As you've probably noticed, I also don't tend to comment my code too often, so it's probably not the best learning aid, though, all the functions and programs should at least be documented to some degree on each page with a few examples to demonstrate.

I hope this helps!

KewlToyZ

  • Guest
Re: Standard DCL question?
« Reply #24 on: May 15, 2012, 02:18:47 PM »
Thanks Lee!! I'll read through it for sure right now.
I messed with my MPL.lsp routine and added the reactor to set dimscale & ltscale from the CANNOSCALE.
But your system would be much smoother in format without slamming every thing in to select one item.

Thank you, those descriptions are much better and clearer than the ones I was making to figure it out.
The _list function had me scratching my head quite a bit.
That and the or function for setq p with the string positions.
While short they confused me a bit how they functioned.
« Last Edit: May 15, 2012, 02:22:15 PM by KewlToyZ »

Sam

  • Bull Frog
  • Posts: 201
Re: Standard DCL question?
« Reply #25 on: May 17, 2012, 02:21:31 AM »
Thanks Lee!! I'll read through it for sure right now.
I messed with my MPL.lsp routine and added the reactor to set dimscale & ltscale from the CANNOSCALE.
But your system would be much smoother in format without slamming every thing in to select one item.

Thank you, those descriptions are much better and clearer than the ones I was making to figure it out.
The _list function had me scratching my head quite a bit.
That and the or function for setq p with the string positions.
While short they confused me a bit how they functioned.

dear sir

error

Quote
Command: mpl

      Scale list being loaded, Please be patient......


** Command not allowed in Model Tab **


32 scales added
 My Scale List Begins....
; error: no function definition: SET_TILE_LIST
Every time we waste electricity, we put our planet's future in the dark. Let's turn around our attiude and start saving power and our planet, before it's too late
http://www.theswamp.org/donate.html

KewlToyZ

  • Guest
Re: Standard DCL question?
« Reply #26 on: May 19, 2012, 08:29:42 AM »
Hey Sam, Let me know what version of AutoCAD you are using.
I did a few corrections.
Check these out:

Sam

  • Bull Frog
  • Posts: 201
Re: Standard DCL question?
« Reply #27 on: May 21, 2012, 01:08:11 AM »
Hey Sam, Let me know what version of AutoCAD you are using.
I did a few corrections.
Check these out:

Dear sir

I am using autocad 2012

same error again

Quote
Command: mpl

      Scale list being loaded, Please be patient......

mspace
** Command not allowed in Model Tab **

Command:

0 scales added
 My Scale List Begins....
; error: no function definition: SET_TILE_LIST
Every time we waste electricity, we put our planet's future in the dark. Let's turn around our attiude and start saving power and our planet, before it's too late
http://www.theswamp.org/donate.html

KewlToyZ

  • Guest
Re: Standard DCL question?
« Reply #28 on: May 21, 2012, 04:59:05 PM »
Hey Sam, I did change the mspace call to an if statement today.
It's not perfect but fits my needs for other routines.
There is the issue of re-using this with other routines I haven't addressed because it would be a complete re-write of my approach I'm not sure how to address yet. I was curious how you are trying to apply this?
The reason being, if the user runs the routine in mspace or model space it works fine.
If the user runs the command with Tilemode = 0 though, CANNOSCALE can only be ran in model space. Cannoscale is in read only when in PSPACE. I've setup the scales routine to be used in the same scenario without shoving all possible scales into it, but I need to re-write based on the same specifics vs. just simply getting it to work.

KewlToyZ

  • Guest
Re: Standard DCL question?
« Reply #29 on: May 21, 2012, 05:00:57 PM »
What I was showing with the VPT command routine, was that the MPL can be applied to set the VPORT scale. In modelspace its global, with VPT it is view port specific.