Author Topic: entmod path in xref / repath  (Read 2544 times)

0 Members and 1 Guest are viewing this topic.

Peter2

  • Swamp Rat
  • Posts: 654
entmod path in xref / repath
« on: January 03, 2018, 02:17:43 PM »
I found a lot of examples here how to "repath" xrefs, and the final code is like this: Replace DXF-code (2 for name, 1 for path) and entmod it.

Code - Auto/Visual Lisp: [Select]
  1. (entmod (subst (cons 2 (vl-filename-base p)) (assoc 2 blk) blk)

I have this fail:
Code - Auto/Visual Lisp: [Select]
  1. Befehl: (setq mod_code (subst (cons 1 "kein.dwg") (assoc 1 b) b))
  2. ((0 . "BLOCK") (2 . "Abrund-2") (70 . 36) (4 . "") (10 0.0 0.0 0.0) (1 . "kein.dwg") (-2 . <Objektname: 24f57768b10>))
  3. Befehl: (entmod mod_code)
  4. nil

Another code uses also these lines:
Code - Auto/Visual Lisp: [Select]
  1. (setq elst (entget (tblobjname "block" (setq bname (cdr(assoc 2 blk))))))
  2.       (setq elst (entget (cdr (assoc 330 elst))))

So maybe I'm maixing something up with Block  / Block record / Block reference?
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: entmod path in xref / repath
« Reply #1 on: January 03, 2018, 04:28:22 PM »
The entity list you use in incomplete and probably the result of (tblnext). For (entmod) to work the entity list should at least contain gc -1 (the reference to the ename).
Use this entity list instead:
Code: [Select]
(entget (tblobjname "block" "Abrund-2"))

Peter2

  • Swamp Rat
  • Posts: 654
Re: entmod path in xref / repath
« Reply #2 on: January 03, 2018, 05:52:22 PM »
Thanks roy_043

I will check tomorrow.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

Peter2

  • Swamp Rat
  • Posts: 654
Re: entmod path in xref / repath
« Reply #3 on: January 04, 2018, 05:26:04 AM »
Strange - still not working:

Code - Auto/Visual Lisp: [Select]
  1. Befehl: (entget (tblobjname "block" "Abrund-2"))
  2. ((-1 . <Objektname: 1b9fa6663a0>) (0 . "BLOCK") (330 . <Objektname: 1b9fa666280>) (5 . "7FA") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbBlockBegin") (70 . 36) (10 0.0 0.0 0.0) (-2 . <Objektname: 1b1ebab8b10>) (2 . "Abrund-2") (1 . "D:\\Beispiele\\Div_Unterlagen\\Herdt_2017\\ACC2017_Uebungsdateien\\Zeichnungen_2017\\Abrund-2.dwg"))
  3. Befehl: (setq mod_code (subst (cons 1 alt_filename) (assoc 1 entlist_lang) entlist_lang))
  4. ((-1 . <Objektname: 1b9fa6663a0>) (0 . "BLOCK") (330 . <Objektname: 1b9fa666280>) (5 . "7FA") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbBlockBegin") (70 . 36) (10 0.0 0.0 0.0) (-2 . <Objektname: 1b1ebab8b10>) (2 . "Abrund-2") (1 . "Abrund-2.dwg"))
  5. Befehl: (entmod mod_code)
  6. nil
  7.  

The code before and after are the same, only gc 1 is modified. But still "nil" for entmod ... ??
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: entmod path in xref / repath
« Reply #4 on: January 04, 2018, 06:22:44 AM »
Maybe the path has to contain a path separator?:
Code: [Select]
(1 . ".\\Abrund-2.dwg")

Peter2

  • Swamp Rat
  • Posts: 654
Re: entmod path in xref / repath
« Reply #5 on: January 04, 2018, 06:46:49 AM »
There must be a problem outside the gc ..

For example, I can pseudo-modify a line with its own, unchanged data:
Code - Auto/Visual Lisp: [Select]
  1. Befehl: (setq x (entget (car (entsel))))
  2. Objekt wählen: ((-1 . <Objektname: 261725ee850>) (0 . "LINE") (330 . <Objektname: 2617f6b3980>) (5 . "66ED") (100 . "AcDbEntity") (67 . 0) (410 . "MODEL") (8 . "RBI_SYMBOL") (370 . 0) (100 . "AcDbLine") (10 73.3121 1935.04 0.0) (11 76.6757 1938.31 0.0) (210 0.0 0.0 1.0))
  3.  
  4. Befehl: (entmod x)
  5. ((-1 . <Objektname: 261725ee850>) (0 . "LINE") (330 . <Objektname: 2617f6b3980>) (5 . "66ED") (100 . "AcDbEntity") (67 . 0) (410 . "MODEL") (8 . "RBI_SYMBOL") (370 . 0) (100 . "AcDbLine") (10 73.3121 1935.04 0.0) (11 76.6757 1938.31 0.0) (210 0.0 0.0 1.0))
  6.  

But this pseudo-changing does not work for Xref. So I have to investigate deeper ...
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

ronjonp

  • Needs a day job
  • Posts: 7531
Re: entmod path in xref / repath
« Reply #6 on: January 04, 2018, 09:02:35 AM »
If I remember correctly I've never been able to successfully modify xref paths with entmod. Are you using AutoCAD for MAC?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Peter2

  • Swamp Rat
  • Posts: 654
Re: entmod path in xref / repath
« Reply #7 on: January 04, 2018, 09:30:39 AM »
Bad news ...

No -no Mac.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

ronjonp

  • Needs a day job
  • Posts: 7531
Re: entmod path in xref / repath
« Reply #8 on: January 04, 2018, 09:42:41 AM »
Bad news ...

No -no Mac.
Then why not use vla-put-path?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Peter2

  • Swamp Rat
  • Posts: 654
Re: entmod path in xref / repath
« Reply #9 on: January 04, 2018, 12:45:12 PM »
yes - "vla-" will be the next step. But now it is clear that "entmod" has problems.
(BTW: In Bricscad it seem to work with entmod - but only quick-tested)
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: entmod path in xref / repath
« Reply #10 on: January 04, 2018, 01:19:17 PM »
If seems strange there is an issue with entmod in this context considering the examples hinted at in the OP. Maybe the new file path is not valid?

Peter2

  • Swamp Rat
  • Posts: 654
Re: entmod path in xref / repath
« Reply #11 on: January 04, 2018, 01:27:48 PM »
As written above ("pseudo-modified"), it also failed (in AutoCAD) using the unchanged gc-code. Tomorrow I will check "entmod in bricscad" and vla-put-path in Acad.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23