Jump to content

Recommended Posts

Posted
That's odd - I can't seem to replicate this error.

Does the error occur on every drawing that you test with the program?

 

Actually no. I tested it on a sample drawing (Small one) and it works well. But on the target drawings gives this error.

 

Your code is extremely perfect. I just need to know the way to rid on this error !

  • 11 months later...
  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • nababeer

    12

  • pBe

    6

  • Lee Mac

    3

  • jahbgd

    1

Top Posters In This Topic

Posted

Same here...

 

Command: RBP

 

Block: $0$_ARCHTICK was not renamed.

Text style: $0$PBG-1.8 was not renamed.

Text style: $0$HDI-ROMANS was not renamed.

Text style: $0$$0$PBG-1.8 was not renamed.

Dimension style: $0$PBG-DIM-1.8 was not renamed.

 

Command: MERGEDIMTXT

; error: ActiveX Server returned an error: Type mismatch

 

Command:

  • 3 months later...
Posted
Lets make a deal. click on this linky first --->lmgtfy

 

I laughed and laughed!

  • 10 years later...
Posted
On 12/21/2013 at 2:08 PM, Lee Mac said:

Try the following nababeer, I hope it helps:

 

 

([color=BLUE]defun[/color] c:mergedimtxt ( [color=BLUE]/[/color] cmd doc pos str )
   ([color=BLUE]setq[/color] doc ([color=BLUE]vla-get-activedocument[/color] ([color=BLUE]vlax-get-acad-object[/color])))
   ([color=BLUE]foreach[/color] col '(textstyles dimstyles)
       (mergedimtxt:processcollection ([color=BLUE]vlax-get-property[/color] doc col))
   )
   ([color=BLUE]vlax-for[/color] blk ([color=BLUE]vla-get-blocks[/color] doc)
       ([color=BLUE]if[/color] ([color=BLUE]=[/color] [color=BLUE]:vlax-false[/color] ([color=BLUE]vla-get-isxref[/color] blk))
           ([color=BLUE]vlax-for[/color] obj blk
               ([color=BLUE]if[/color]
                   ([color=BLUE]and[/color]
                       ([color=BLUE]wcmatch[/color] ([color=BLUE]vla-get-objectname[/color] obj) [color=MAROON]"AcDb*Text,AcDb*Dimension"[/color])
                       ([color=BLUE]setq[/color] str ([color=BLUE]vla-get-stylename[/color] obj)
                             pos ([color=BLUE]vl-string-position[/color] 36 str [color=BLUE]nil[/color] [color=BLUE]t[/color])
                       )
                       ([color=BLUE]vlax-write-enabled-p[/color] obj)
                   )
                   ([color=BLUE]vla-put-stylename[/color] obj ([color=BLUE]substr[/color] str ([color=BLUE]+[/color] 2 pos)))
               )
           )
       )
   )
   ([color=BLUE]setq[/color] cmd ([color=BLUE]getvar[/color] 'cmdecho))
   ([color=BLUE]setvar[/color] 'cmdecho 0)
   ([color=BLUE]setvar[/color] 'textstyle [color=MAROON]"Standard"[/color])
   ([color=BLUE]command[/color] [color=MAROON]"_.-dimstyle"[/color] [color=MAROON]"_r"[/color] [color=MAROON]"Standard"[/color] [color=MAROON]"_.-purge"[/color] [color=MAROON]"_r"[/color] [color=MAROON]"*"[/color] [color=MAROON]"_n"[/color] [color=MAROON]"_.-purge"[/color] [color=MAROON]"_a"[/color] [color=MAROON]"*"[/color] [color=MAROON]"_n"[/color])
   ([color=BLUE]setvar[/color] 'cmdecho cmd)
   ([color=BLUE]vla-regen[/color] doc [color=BLUE]acallviewports[/color])
   ([color=BLUE]princ[/color])
)
([color=BLUE]defun[/color] mergedimtxt:processcollection ( col [color=BLUE]/[/color] pos str )
   ([color=BLUE]vlax-for[/color] obj col
       ([color=BLUE]if[/color]
           ([color=BLUE]and[/color]
               ([color=BLUE]setq[/color] str ([color=BLUE]vla-get-name[/color] obj)
                     pos ([color=BLUE]vl-string-position[/color] 36 str [color=BLUE]nil[/color] [color=BLUE]t[/color])
               )
               ([color=BLUE]vl-catch-all-error-p[/color] ([color=BLUE]vl-catch-all-apply[/color] '[color=BLUE]vla-item[/color] ([color=BLUE]list[/color] col ([color=BLUE]substr[/color] str ([color=BLUE]+[/color] 2 pos)))))
           )
           ([color=BLUE]vla-put-name[/color] obj ([color=BLUE]substr[/color] str ([color=BLUE]+[/color] 2 pos)))
       )
   )
)
([color=BLUE]vl-load-com[/color]) ([color=BLUE]princ[/color])
 

 

 

Hi there,
It’s been a long time since this post, but I’m trying to do the same thing and I’m having trouble merging all the text styles.

Here’s some progress on the routine that fixes the ActiveX server returned an error: type mismatch! error. thanks to komondormrex.

However, I still can’t merge all the text styles. I’m attaching a sample file.

Cheers!

(defun c:mergedimtxt (/ cmd doc pos str)
  (setq doc (vla-get-activedocument (vlax-get-acad-object)))
  (foreach col '(textstyles dimstyles)
    (mergedimtxt:processcollection (vlax-get-property doc col))
  )
  (vlax-for blk (vla-get-blocks doc)
    (if (= :vlax-false (vla-get-isxref blk))
      (vlax-for obj blk
        (if
          (and
            (wcmatch (vla-get-objectname obj) "AcDb*Text,AcDb*Dimension")
            (setq str (vla-get-stylename obj)
                  pos (vl-string-position 36 str nil t)
            )
            (vlax-write-enabled-p obj)
          )
          (vla-put-stylename obj (substr str (+ 2 pos)))
        )
      )
    )
  )
  (setq cmd (getvar 'cmdecho))
  (setvar 'cmdecho 0)
  (setvar 'textstyle "Standard")
  (command "_.-dimstyle" "_r" "Standard" "_.-purge" "_r" "*" "_n" "_.-purge" "_a" "*" "_n")
  (setvar 'cmdecho cmd)
  (vla-regen doc acAllViewports)
  (princ)
)

(defun mergedimtxt:processcollection (col / pos str obj_dxf)
  (vlax-for obj col
    (if
      (and
        (setq str (vla-get-name obj)
              pos (vl-string-position 36 str nil t)
        )
        (vl-catch-all-error-p
          (vl-catch-all-apply 'vla-item (list col (substr str (+ 2 pos))))
        )
      )
      (entmod (subst (cons 2 (substr str (+ 2 pos))) (assoc 2 (setq obj_dxf (entget (vlax-vla-object->ename obj)))) obj_dxf))  ;komondormrex
    )
  )
)
(vl-load-com)
(princ)

 

Drawing6.dwg

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