Author Topic: Help me with my TEXT utility please.  (Read 4211 times)

0 Members and 1 Guest are viewing this topic.

One Shot

  • Guest
Help me with my TEXT utility please.
« on: April 22, 2005, 10:57:44 AM »
I am using this list that merges text styles.   It is merging all the styles except for 1 styel  That style is:

Code: [Select]

(StyleChange "HANDWGTITLES" "DWGTITLES")


What would cause this style no to merge?

Code: [Select]

;;  To see the styles in a DWG enter -style at the command line, then ?


;;  This changes text & Mtext from one style to another
;;  The old style is still in the drawing

(defun c:BCtxtfix()
  (StyleChange "DWGTITLE" "DWGTITLES")
  (StyleChange "HANDDWGTITLE" "DWGTITLES")
  (StyleChange "HANDWGTITLE" "DWGTITLES")
  (StyleChange "HANDWGTITLES" "DWGTITLES")
  (StyleChange "CONDHAND" "DWGTITLES")
(princ)
)


(defun StyleChange (OlSty NuSty / filterList ss NuStyList entList
                          NuEntList NextEnt)
 ;;fix the case
 (setq OlSty (strcase OlSty))
 ;;fix the case
 (setq NuSty (strcase NuSty))
 ;;build a filter to select only text with that style
 ;;Note: DXF group code 7 is the style of a text entity
 ;;     0 is the entity type
 (setq FilterList (list '(0 . "TEXT,MTEXT") (cons 7 OlSty)))
 
 (cond
   ((null(setq ss (ssget "X" FilterList)));put the text in a selection set.
    (alert (strcat "Found No text with style "OlSty))
   )
  (
   ;;check and make sure NuSty exist
   (tblsearch "STYLE" NuSty)
   ;;make a dotted pair
   (setq NuStyList (cons 7 NuSty))
   ;;set a counter
   (setq n 0)
   ;;grab the first ent in the ss
   (setq NextEnt (ssname ss n))

   ;;loop until all ents changed
   (while NextEnt
    ;;get the list
    (setq EntList (entget NextEnt))
    ;;get the old style
    (setq OlStyLst (assoc 7 EntList))
    ;;replace it in the list
    (setq NuEntList (subst NuStyList OlStyLst EntList))
    ;;change the ent
    (entmod NuEntList)
    ;;update the screen
    (entupd (cdr (assoc -1 NuEntList)))
    ;;increment
    (setq n (1+ n))
    ;;grab next
    (setq NextEnt (ssname ss n))
   ) ;_ end of while
    (alert (strcat (itoa n) " Items Changed "))
  )
  (
   ;;otherwise you blew it.
   T
   (alert (strcat "Hey You,\n\n"
      NuSty
      " doesn't exist!"
    ) ;_ end of strcat
   ) ;_ end of alert
)
  (command "_.-purge" "textstyles" "DWGTITLE,HANDDWGTITLE,HANDWGTITLE,HANDWGTITLES,CONDHAND")
  (command "_.regen")
  (command "_.undo" "end")
  (setvar "cmdecho" 1)
  (princ)
)  
 ) ;_ end of cond
  (princ)
) ;_ end of defun

whdjr

  • Guest
Help me with my TEXT utility please.
« Reply #1 on: April 22, 2005, 11:10:00 AM »
Is that text style within an attribute?  
Your list
Code: [Select]
(setq FilterList (list '(0 . "TEXT,MTEXT") (cons 7 OlSty))) will not select attributes.  Why not just leave out the "0" reference and just use the "7".  I have not tested it yet but it sounds good. :D

One Shot

  • Guest
Help me with my TEXT utility please.
« Reply #2 on: April 22, 2005, 11:17:09 AM »
Quote from: whdjr
Is that text style within an attribute?  
Your list
Code: [Select]
(setq FilterList (list '(0 . "TEXT,MTEXT") (cons 7 OlSty))) will not select attributes.  Why not just leave out the "0" reference and just use the "7".  I have not tested it yet but it sounds good. :D



Thank you, it works.  One more question.  At the purge line of the lisp.  I added that and I am not sure if it will work.  Does it look correct?

whdjr

  • Guest
Help me with my TEXT utility please.
« Reply #3 on: April 22, 2005, 11:23:12 AM »
You should add a "No" at the end of the purge command:
Code: [Select]
(command "_.-purge" "textstyles" "DWGTITLE,HANDDWGTITLE,HANDWGTITLE,HANDWGTITLES,CONDHAND" "No")

One Shot

  • Guest
Help me with my TEXT utility please.
« Reply #4 on: April 22, 2005, 11:29:11 AM »
Quote from: whdjr
You should add a "No" at the end of the purge command:
Code: [Select]
(command "_.-purge" "textstyles" "DWGTITLE,HANDDWGTITLE,HANDWGTITLE,HANDWGTITLES,CONDHAND" "No")


Thank you for your help!

brad

One Shot

  • Guest
Help me with my TEXT utility please.
« Reply #5 on: April 22, 2005, 07:27:48 PM »
Quote from: One Shot
Quote from: whdjr
You should add a "No" at the end of the purge command:
Code: [Select]
(command "_.-purge" "textstyles" "DWGTITLE,HANDDWGTITLE,HANDWGTITLE,HANDWGTITLES,CONDHAND" "No")


Thank you for your help!

brad


Who changed this thread to this name?

Help me with my TEXTuality, please.   I went to look for the title of that lisp and found that it was changed.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Help me with my TEXT utility please.
« Reply #6 on: April 22, 2005, 07:35:58 PM »
I could hazard a guess based on the current name but I won't, hee hee.

I don't recall what it was called before, but I'm guessing it wasn't very descriptive (that gets a couple of us going), so it was renamed (again, guessing) so down the road we might understand what lies herein.

Should it be called "Help me with my text utility please"?

If so I'll rename it for you (assuming you so desire).
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

One Shot

  • Guest
Help me with my TEXT utility please.
« Reply #7 on: April 22, 2005, 07:46:58 PM »
Quote from: MP
I could hazard a guess based on the current name but I won't, hee hee.

I don't recall what it was called before, but I'm guessing it wasn't very descriptive (that gets a couple of us going), so it was renamed (again, guessing) so down the road we might understand what lies herein.

Should it be called "Help me with my text utility please"?

If so I'll rename it for you (assuming you so desire).


Please if you don't mind.  It was funny!  I thought that I posted it earlier.  When I did not see that name, I thought that I was going crazy!  While I have your attention. I am having problems with this file loading up every session.   The lisp are in the correct path.

This is what I have put at the acaddoc.lsp to load the acaddoc1.lsp

Code: [Select]

*********************************************************************************************************
Date Modified: 04/22/05
By Whom: Bcrouse
(autoload "AcadDoc1.lsp" ))
)
(princ)
)


Here is the acaddoc1.lsp.  I only have the first lsip loading.  The other two will not load.

Code: [Select]

;;  ==============================================================================
;;  ACADDOC1.LSP
;;  
;;
;;  ==============================================================================
;;
;;  ACADDOC1.LSP  ver. 2005
;;
;;  B.N. Crouse
;;  04/22/05  
;;  FUNCTION Defuns
;;  ==============================================================================    
;;
(load "fixtextstyle.lsp")

;; This then runs the c:fx function as you have it defined
;; in the fixtextstyle.lsp file
(c:fx)

;;  ==============================================================================    
;;
(load "MergeTextStyle.LSP")

;; This then runs the c:BCtxtfix function as you have it defined
;; in the MergeTextStyle.LSP.lsp file
(c:BCtxtfix)

;;  ==============================================================================    
;;
(load "killashade.lsp")

;; This then runs the c:KILLASHADE function as you have it defined
;; in the KILLASHADE.lsp file
(c:KILLASHADE)

;;  ==============================================================================


Can you please help me out?

Thank you,

Brad

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Help me with my TEXT utility please.
« Reply #8 on: April 22, 2005, 07:52:39 PM »
Renamed the thread. Just on my way home; I'll try to have a look later tonight. Cheers!
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

daron

  • Guest
Help me with my TEXT utility please.
« Reply #9 on: April 25, 2005, 08:43:39 AM »
Glad you thought it was funny. I changed it. I also changed your other one.

*Note: When writing a title to a thread, many people, upon seeing something like "Another LISP question..." will not even look at the thread and you'll end up loosing a valuable set of resources that otherwise would've helped you. Also, if I or any other MOD renames your or anybody elses threads, and you'd prefer it said something a little less dramatic, just edit your original post and you can edit the title too. Just realize that if you change it back or to something inappropriate, we can and will delete the entire thread. In other words, it's better to work with us than against us. I'm not trying to be a hard-nose, just trying to explain the basics.

One Shot

  • Guest
Help me with my TEXT utility please.
« Reply #10 on: April 25, 2005, 04:45:50 PM »
Quote from: MP
Renamed the thread. Just on my way home; I'll try to have a look later tonight. Cheers!


Have you had a chance to check this lisp to see what would make it not to load?

Thank you

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Help me with my TEXT utility please.
« Reply #11 on: April 25, 2005, 09:34:18 PM »
Sorry, slipped my banana peel mind. Checking it out now ...
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Help me with my TEXT utility please.
« Reply #12 on: April 25, 2005, 09:56:42 PM »
What if you temporarilly replace your startup function with this --

Code: [Select]
(defun s::startup ( / MyLoad )

    (defun MyLoad ( filename / path result )
        (if (setq path (findfile filename))
            (setq result
                (/= 'failed
                    (load path 'failed)
                )
            )    
        )
        (if (null result)
            (princ
                (strcat
                    "Failed to load <"
                    filename
                    ">.\n"
                )
            )
        )
        result
    )
   
    (if (MyLoad "FixTextStyle.lsp")
        (if c:Fx (c:Fx)
            (princ "No c:Fx command defined.\n")
        )
    )    
   
    (if (MyLoad "MergeTextStyle.LSP")
        (if c:BCTxtFix (c:BCTxtFix)
            (princ "No c:BCTxtFix command defined.\n")
        )
    )    

    (if (MyLoad "KillAshade.lsp")
        (if c:KillAshade (c:KillAshade)
            (princ "No c:KillAshade command defined.\n")
        )
    )    

    (princ)

)

It may point out where the problem lies.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst