Author Topic: What is deference between these 2 blocks?  (Read 4003 times)

0 Members and 1 Guest are viewing this topic.

HasanCAD

  • Swamp Rat
  • Posts: 1420
What is deference between these 2 blocks?
« on: September 05, 2017, 01:00:44 PM »
HI all
I have thee 2 block with the same name and all properties
but one ofthem is mirrored
why? and how to solve this issue?

ChrisCarlson

  • Guest
Re: What is deference between these 2 blocks?
« Reply #1 on: September 05, 2017, 02:15:21 PM »
A question which should be answered first, how did you arrive to this situation?

ronjonp

  • Needs a day job
  • Posts: 7526
Re: What is deference between these 2 blocks?
« Reply #2 on: September 05, 2017, 02:19:38 PM »
The incorrect text from the mirror is a result of MIRRTEXT being set to 1.
« Last Edit: September 05, 2017, 02:52:26 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Crank

  • Water Moccasin
  • Posts: 1503
Re: What is deference between these 2 blocks?
« Reply #3 on: September 05, 2017, 02:30:14 PM »
When you list both blocks, you'll notice a difference of the extrusion direction relative to UCS. The blocks are not on the same UCS.
Z=-1 means that you look at that block from behind.

You can fix this with the ALIGN command.
You'll need 3 points:
- end of arc > other end of arc
- corner 1 > opposite of corner 1
- other corner > opposite of other corner
Vault Professional 2023     +     AEC Collection

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: What is deference between these 2 blocks?
« Reply #4 on: September 06, 2017, 04:38:07 AM »
A question which should be answered first, how did you arrive to this situation?
In fact this file I recives from our branch in another country. They making kiling mistakes like this and saying we are not profesional in AutoCAD same as you, Hassan please fixing errors.

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: What is deference between these 2 blocks?
« Reply #5 on: September 06, 2017, 04:40:06 AM »
The incorrect text from the mirror is a result of MIRRTEXT being set to 1.
Thanks for your solution but when run the lisp the blocks moves to aother place

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: What is deference between these 2 blocks?
« Reply #6 on: September 06, 2017, 04:41:28 AM »
When you list both blocks, you'll notice a difference of the extrusion direction relative to UCS. The blocks are not on the same UCS.
Z=-1 means that you look at that block from behind.

You can fix this with the ALIGN command.
You'll need 3 points:
- end of arc > other end of arc
- corner 1 > opposite of corner 1
- other corner > opposite of other corner
It is very good way, But these are 3 files with thounds of blocks with this error.

ronjonp

  • Needs a day job
  • Posts: 7526
Re: What is deference between these 2 blocks?
« Reply #7 on: September 06, 2017, 11:00:30 AM »
When you list both blocks, you'll notice a difference of the extrusion direction relative to UCS. The blocks are not on the same UCS.
Z=-1 means that you look at that block from behind.

You can fix this with the ALIGN command.
You'll need 3 points:
- end of arc > other end of arc
- corner 1 > opposite of corner 1
- other corner > opposite of other corner
It is very good way, But these are 3 files with thounds of blocks with this error.
This seems to work with your example drawing:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ i)
  2.   ;; No locked layer check
  3.     (vlax-for b a
  4.       (if (and (= "AcDbBlockReference" (vla-get-objectname b))
  5.                (= "C1-T1" (vla-get-name b))
  6.                (setq i (vlax-get b 'normal))
  7.                (minusp (last i))
  8.           )
  9.         (progn (vlax-put b 'normal (list (car i) (cadr i) (abs (caddr i))))
  10.                (vla-put-xscalefactor b (- (vla-get-xscalefactor b)))
  11.         )
  12.       )
  13.     )
  14.   )
  15.   (command "_.attsync" "_Name" "C1-T1")
  16.   (princ)
  17. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: What is deference between these 2 blocks?
« Reply #8 on: September 06, 2017, 11:22:07 AM »
...
This seems to work with your example drawing:
...
Thnaks Ron
I devolped in another way
to get properties from the block then insert another one with same properties
but faced a bug in some blocks need to rotate and some no
I tried to inderstand how to rotate the block for example by pressing < or > put could not
So could you please help me in this step
Code - Auto/Visual Lisp: [Select]
  1. (defun c:BMI ( / b doc i l n o p r spc x y z )
  2.           spc (if (zerop (vla-get-activespace doc))
  3.                 (if (= (vla-get-mspace doc) :vlax-true)
  4.                   (vla-get-modelspace doc) (vla-get-paperspace doc))
  5.                 (vla-get-modelspace doc)))
  6.   (while t
  7.     (if (and
  8.         (setq o (car (entsel)))
  9.         (setq o (vlax-ename->vla-object o))
  10.         (setq i (vlax-get o 'normal))
  11.         (> 0 (nth 2 i))
  12.         )
  13.     (progn
  14.       (setq p (vlax-get o 'InsertionPoint))
  15.       (setq l (vlax-get o 'layer))
  16.       (setq r (vlax-get o 'Rotation))
  17.       (setq x (vlax-get o 'XScaleFactor))
  18.       (setq y (vlax-get o 'YScaleFactor))
  19.       (setq z (vlax-get o 'ZScaleFactor))
  20.       (setq n (vlax-get-property o (if (vlax-property-available-p o 'EffectiveName) 'EffectiveName 'Name)))
  21.       (vl-catch-all-error-p (setq b (vl-catch-all-apply (function vla-InsertBlock) (list spc (vlax-3D-point p) n x y z (+ r 3.14159)))))
  22.       (vlax-put b 'layer l)
  23.       (command "_.attsync" "_Name" n)
  24.       (vla-delete o)
  25.       ))))

ronjonp

  • Needs a day job
  • Posts: 7526
Re: What is deference between these 2 blocks?
« Reply #9 on: September 06, 2017, 02:59:06 PM »
If you have many of these to do why are you picking each one manually? Give the code below a try .. although you're going to have to also account for the current attribute values too.
Code - Auto/Visual Lisp: [Select]
  1. (defun c:bmi (/ b doc i l n o p r spc x y z)
  2.         spc (if (zerop (vla-get-activespace doc))
  3.               (if (= (vla-get-mspace doc) :vlax-true)
  4.                 (vla-get-modelspace doc)
  5.                 (vla-get-paperspace doc)
  6.               )
  7.               (vla-get-modelspace doc)
  8.             )
  9.   )
  10.   (while (and (setq o (car (entsel)))
  11.               (setq o (vlax-ename->vla-object o))
  12.               (setq i (vlax-get o 'normal))
  13.               (> 0 (nth 2 i))
  14.          )
  15.     (progn (setq p (vlax-get o 'insertionpoint))
  16.            (setq l (vlax-get o 'layer))
  17.            (setq r (vlax-get o 'rotation))
  18.            (setq x (- (vlax-get o 'xscalefactor)))
  19.            (setq y (vlax-get o 'yscalefactor))
  20.            (setq z (vlax-get o 'zscalefactor))
  21.            (setq n (vlax-get-property
  22.                      o
  23.                      (if (vlax-property-available-p o 'effectivename)
  24.                        'effectivename
  25.                        'name
  26.                      )
  27.                    )
  28.            )
  29.            (vl-catch-all-error-p
  30.              (setq
  31.                b (vl-catch-all-apply (function vla-insertblock) (list spc (vlax-3d-point p) n x y z r))
  32.              )
  33.            )
  34.            (vlax-put b 'layer l)
  35.            (command "_.attsync" "_Name" n)
  36.            (vla-delete o)
  37.     )
  38.   )
  39.   (princ)
  40. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: What is deference between these 2 blocks?
« Reply #10 on: September 12, 2017, 11:48:43 AM »
If you have many of these to do why are you picking each one manually? Give the code below a try .. although you're going to have to also account for the current attribute values too.

Thanks Ron for your value help

ronjonp

  • Needs a day job
  • Posts: 7526
Re: What is deference between these 2 blocks?
« Reply #11 on: September 12, 2017, 12:14:12 PM »
If you have many of these to do why are you picking each one manually? Give the code below a try .. although you're going to have to also account for the current attribute values too.

Thanks Ron for your value help
You're welcome :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC