TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ELOQUINTET on November 06, 2003, 10:55:20 AM
-
hey guys i'm wondering how to create a dcl file and if what i want is possible. i have a bunch of lisps i would like to combine into a dcl. they add suffixs after dimension text for instance:
(defun C:DLO()
(setq ent (vlax-ename->vla-object (car (entsel "select dim"))))
;(vla-put-TextOverride ent "{\\Farial.shx;<> D.L.O.}")
(vla-put-TextOverride ent "{<>\ D.L.O.}")
(vlax-release-object ent)
)
i would like a dcl that would have various suffixs. is this possible and am i on the right track or no? thanks
dan
-
is this possible and am i on the right track
Yes and yes. And BTW, great idea. :D
If I get some time today I'll help you get started.
-
thanks just trying to get people to use lisp but when people see all the code they panic so i'm trying to get them to use lisp without knowing their doing so :wink: thanks mark
dan
-
Ok, I have uploaded an example to the lilly pond http://www.theswamp.org/lilly.pond/public/suffixlist.zip give it a try. Remember that at least the .dcl file has to be in your ACAD path.
here's the code
(defun c:dimsuffix (/ dcl_id lst ent obj suff)
; list of dim suffix's
(setq lst (list " one " " two " " three "))
; get user input
(if (setq ent (entsel "select dim"))
(setq obj (vlax-ename->vla-object (car ent)))
)
(if
(and obj (vlax-property-available-p obj 'TextSuffix T))
(progn
; dialog stuff
(setq dcl_id (load_dialog "suffixlist.dcl"))
(if (not (new_dialog "sufflist" dcl_id))
(exit) ;if dialog not found..exit
) ;end if
(start_list "Slist")
(mapcar 'add_list lst)
(end_list)
(action_tile
"accept"
"(progn
(setq suff (get_tile \"Slist\"))
(done_dialog)
)"
)
(action_tile
"cancel" "(done_dialog)
(exit)"
)
(start_dialog)
(unload_dialog dcl_id)
); progn
; else
(alert "Selected object does appear to be a dimension")
) ;if
(if suff
(progn
(vlax-put-property obj 'TextSuffix (nth (atoi suff) lst))
(vlax-release-object obj)
)
); if
(princ)
) ; defun
DCL code
sufflist : dialog {
label = "Dim Suffix List";
: boxed_column {
label = "Select Dim Suffix";
: list_box {
key = "Slist";
allow_accept=true;
}
}
ok_cancel;
}
-
thanks mark for all your efforts. pardon my ignorance but do i need to add my various code in and if so where do i put it. secondly, i create the top as a lisp and the bottom as a dcl. as you can tell i've never created dcl before. where do i do this. the lisp part i got vlide but dcl not sure. gracias
dan
-
ah i see you can create dcl in vlide but the other question is still on the table
dan
-
Ok, from the top.
1) make a new folder, say c:\lisp-dan
2) add that folder to the ACAD "Support file search path"
3) unzip file from lilly pond in new folder (c:\lisp-dan)
4) load lisp file into ACAD (load "dimsuffix")
5) in ACAD type dimsuffix and follow prompts
the dimsuffix program will load the .dcl file so long as it's in the ACAD search path.
You can add your code to the lisp but, it has to be in the right place. I tried to give you something to work with and learn from, if it gets the best of ya just yell. :D
-
Just to mode sure you understand: The dcl file has to be in its own file. You cannot put it in the same file as a lisp.
-
ah i gotcha it's up and running. i had cut and pasted the code from the forum created both and was putting my suffixes in place of "1" "2" "3".
gosh it's scary i'm beginning to kinda understan this mumbo jumbo. uhhum kinda. question though i have quite a few suffixes so as i'm adding to the list what if any type of structure do i have to keep i.e. the one i was editing looked like this but it didn't return just kept going. just trying to learn the proper way. thanks a bunch man
dan
; list of dim suffix's
(setq lst (list " D.L.O. " " V.I.F. " " O.A. " " O.D. " " I.D. " " PANEL " " DOOR "))
-
by the way mark i had created an addons folder in my acad support folder but you say it's best to keep it seperate? i'll take your advice thanks
dan
-
question though i have quite a few suffixes so as i'm adding to the list what if any type of structure do i have to keep i.e. the one i was editing looked like this but it didn't return just kept going.
; list of dim suffix's
(setq lst (list " D.L.O. " " V.I.F. " " O.A. " " O.D. " " I.D. " " PANEL " " DOOR "))
The one you show here looks fine, if I understand correctly that is. :D
I would like to make the program read a list of suffix/prefix from a file, and also have a user interface for adding to the list. Hows that sound?
-
ummm yeah sure as long as it works. one thing i would like also is a bigger dialogue box so you don't have to scroll down. also is there a way to make it so you can select multiple dims or maybe if it remebered the previous suffix you added. these would all be nice. cheers
dan
-
Why don't you give it a try. Think of the keyword; width.
-
A new and improved version. See .txt file in the link below.
http://www.theswamp.org/lilly.pond/public/DimPrefixSuffix.zip
-
hey mark back to my dim suffix dcl. i am using it now and don't recall this happening before. in our dimstyle we use fractional and add an " suffix. well when i add my suffix it wipes out the inch. how do i get it to just add to the existing suffix? this is also a problem in that if for some reason i want to change the suffix or omit it i have to do so in properties vs in text edit.
dan
-
I'm working on that Dan, I'm also going to have it read the prefix/suffix list from a file. Maybe done today with a beta version.
-
ok thanks mark got so sidetracked with that menu mess i fogot about this
dan
-
o yeah and remember multiple selection or remembering the last selection
(if that's not too much to ask) :oops:
dan
-
o yeah and remember multiple selection or remembering the last selection
It does that now, does it not?
-
no if i repeat the command and don't select another suffix it reverts to the top suffix. this may be because i am using the original maybe you did fix it in the vlx version you did later. i'm not using that one because i can't open the file to add new suffixes as they come to mind. sorry my mistake :oops: i'll keep my big mouth shut
dan
-
Dan you are going to love the next version. :D
-
:? zip my mouth is shut
dan
-
new version, read the .txt file.
http://theswamp.org/swamp.files/mark/DimPrefixSuffix.zip
-
thanks mark works great. just wondering is there a way to rather than add this as a suffix to add it to add it so if you going into dimedit you will see a.f.f. or whatever so you could remove it that way rather than going into properties. it works alright as is for me but i'm thinking of others who might not know where to look for the suffix to remove it if need be.
dan
-
You mean add an option to remove a suffix?
-
yeah i'm just thinking about my boss coming to me and asking me where the v.i.f. is when he tries to omit it using the dim editor. is there a way to make the text that's added show up in the text editor instead of as a suffix. with it being a suffix someone could do match properties and another dimension would then have f.s. after it, not good. actually i did it and i know what the program does. if this is alot of work don't bother i was just thinking it might make it more idiot proof. thanks man
dan
-
Dan, I'm still not sure what it is you are talking about, sorry! But, maybe this version will clear things up.
http://www.theswamp.org/swamp.files/mark/DimPrefixSuffix.zip
-
Oh, the light just came on! Now I see what you are refering to. :D You want a way to edit the prefix/suffix without going to the poprerties dialog. Right?
-
if you go into the mtext editor which is how they are accustomed to adding dim suffixes there is nothing after the carrots. i would like it to be added so it would show up here rather than as a true suffix or prefix if that's possible. this way if someone does match properties the other dimension does not inheret an improper suffix. not to metion if it already has a suffix. so it would then say 133" d.l.o. f.s. i can just see that disaster coming. sorry i've kinda lead you down the wrong path but you know how you sometimes don't think about these type things til it's done. hope this helps explain what i mean
dan
-
We're talking text override......
This is going to change the WHOLE program!
It's time for a new thread folks, be back soon.
>i can just see that disaster coming
So it's your job Dan to educate the other users. :D
-
Heh
-
Ok, so I went back to post no.1 in this thread and there it is plain as day! (vla-put-TextOverride ent so I lead myself down the wrong path, not you Dan. Oh well ...........
-
i'm really sorry mark i kind of mislead you a little by calling it a suffix instead of a text override too :( . you're right about the education though. i'm trying to put together tools to help others here but i'm not a cad manager and have tons of work of my own to do so i need things that are very streamline so i'm not having to go help them every 5 minutes ya know. i will educate them but i can only take baby steps unfortunately. i have created a lisp folder in our library which also has some tutorials but i only have so much time to dedicate to it. maybe we should start a new thread eh.
dan
-
>maybe we should start a new thread eh.
Let's.