Author Topic: External Reference PathType  (Read 4308 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
External Reference PathType
« on: December 14, 2014, 09:43:21 PM »
I'm having some trouble with non-English  AutoCAD (French particularly this time ) setting an XREF pathType to Partial programmatically.
( and it's a bit of a plane ride to test on site )

I'd like to have anyone interested run this and report back the result and the build nationality you're using.

Code - Auto/Visual Lisp: [Select]
  1. (or *:acad (setq *:acad (vlax-get-acad-object)))
  2. (or *:acdoc (setq *:acdoc (vla-get-activedocument *:acad)))
  3. (or *:blocks (setq *:blocks (vla-get-blocks *:acdoc)))
  4.  
  5. (defun c:doit (/)
  6.    (if (and (setq
  7.                ename
  8.                  (entsel "\nSelect an XREF to change PathType to Partial."
  9.                  )
  10.             )
  11.             (setq SelObj (vlax-ename->vla-object (car ename)))
  12.             (= (vla-get-objectname SelObj) "AcDbBlockReference")
  13.             (= :vlax-true (vla-get-isxref
  14.                   (setq RefObj (vla-item *:blocks (vla-get-name SelObj)))
  15.                )
  16.             )
  17.             (setq xrefName (vla-get-name SelObj))
  18.             (setq blkpath (vla-get-path SelObj))
  19.             (print blkpath)
  20.             (if (not (= "." (substr blkpath 1 1)))
  21.                (vl-cmdf "_.-xref" "_pathType" xrefName "_Relative")
  22.             )
  23.             (vl-cmdf "_draworder" (car ename) "" "_Back")
  24.        )
  25.       (print (vla-get-path SelObj))      
  26.    )
  27.    (print "\nThanks for all the fish")
  28.    (princ)
  29. )
  30.  

Something like
English Build result:
Command: DOIT
Select an XREF to change PathType to Partial.
"N:\\TardisTest-1.dwg"
1 path(s) changed.
"..\\..\\..\\..\\..\\..\\TardisTest-1.dwg"
Thanks for all the fish
Command:


Thanks for playing.

Added : Just need to wait for Europe to wake up
fixed vla-get-isxref conditional test ; reload attachment
« Last Edit: December 15, 2014, 06:56:49 AM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

NICK_VNV

  • Newt
  • Posts: 63
Re: External Reference PathType
« Reply #1 on: December 15, 2014, 01:17:32 AM »
There is no "_pathType" option for "_.-xref" command, it has only "_Path" in Civil3d 2013 (rus)
P.S. and earlier versions too
« Last Edit: December 15, 2014, 01:26:21 AM by NICK_VNV »
Sorry for my English...

HasanCAD

  • Swamp Rat
  • Posts: 1421
Re: External Reference PathType
« Reply #2 on: December 15, 2014, 03:07:59 AM »
I am in Arabic native and the AutoCAD interface is english

Code: [Select]
Select an XREF to change PathType to Partial.
"D:\\Projects\\حسن\\S\\GRID.dwg" _.-xref
Enter an option [?/Bind/Detach/Path/pathType/Unload/Reload/Overlay/Attach] <Attach>: _pathType
Enter xref name(s) to edit path type: GRID
Enter new path type [Full/Relative/None]: _Relative
1 path(s) changed.
Command: _draworder
Select objects:   1 found

Select objects:
Enter object ordering option [Above objects/Under objects/Front/Back] <Back>: _Back
Command:
"..\\حسن\\S\\GRID.dwg"
"\nThanks for all the fish"

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: External Reference PathType
« Reply #3 on: December 15, 2014, 03:18:44 AM »
Interesting info  Nick, Thanks.

Excellent HasanCAD, that is a good start.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: External Reference PathType
« Reply #4 on: December 15, 2014, 04:22:51 AM »
Kerry you should check lines 14-17. This portion returns T for all block definitions (... and using the variable name RefObj is of course confusing).

Patrick_35

  • Guest
Re: External Reference PathType
« Reply #5 on: December 15, 2014, 05:15:50 AM »
ah the french ... ;)

For the code in french (i don't find international command)
Code: [Select]
(vl-cmdf "_.-xref" "TY" xrefName "_Relative")
A lisp that I had done that works with french's version

@+

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: External Reference PathType
« Reply #6 on: December 15, 2014, 06:44:40 AM »
Kerry you should check lines 14-17. This portion returns T for all block definitions < .. >
Ooops, I missed the  (= :vlax-true ) ...

< .. >  (... and using the variable name RefObj is of course confusing).
I wanted to mentally distinguish between the insert selected and the reference from the blockTable


ah the french ... ;)

For the code in french (i don't find international command)
Code: [Select]
(vl-cmdf "_.-xref" "TY" xrefName "_Relative")
A lisp that I had done that works with french's version

@+

Thanks Patrick. I have seen the literal French prompts but I'd prefer to use code that was international ; hence the attempt to use _pathType
« Last Edit: December 15, 2014, 06:49:37 AM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

NICK_VNV

  • Newt
  • Posts: 63
Re: External Reference PathType
« Reply #7 on: December 15, 2014, 07:34:10 AM »
Sorry for my English...

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: External Reference PathType
« Reply #8 on: December 15, 2014, 08:36:49 AM »
I wanted to mentally distinguish between the insert selected and the reference from the blockTable
The confusing bit is that what you call 'RefObj' is a block definition (the insert is the reference object here). Well, it was confusing to me anyway. :wink:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: External Reference PathType
« Reply #9 on: December 15, 2014, 02:21:24 PM »
ah the french ... ;)

For the code in french (i don't find international command)
Code: [Select]
(vl-cmdf "_.-xref" "TY" xrefName "_Relative")

Patrick,
Does this work for you ?
Code - Auto/Visual Lisp: [Select]
  1. (vl-cmdf "_.-xref" "_pathType" xrefName "_Relative")

I understand that
Code - Auto/Visual Lisp: [Select]
  1. (vl-cmdf "_.-xref" "TY" xrefName "_Relative")
works in both English and French versions because of the happy coincidence tht
"TY"
can represent both
pathType  and
TYpechemin

That aside, I'd still like to see an International solution :)
« Last Edit: December 15, 2014, 02:26:16 PM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Patrick_35

  • Guest
Re: External Reference PathType
« Reply #10 on: December 16, 2014, 02:15:04 AM »
Before giving my reply, I tried "_pathType" and "_type" and it does not work
"TY" is the french option
On older version of AutoCAD, we could find the international commands with the arrow keypad, but not now  :-(

@+

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: External Reference PathType
« Reply #11 on: December 16, 2014, 03:58:57 AM »

Thanks Patrick.

I have used the "TY" option because it works in English and French versions.

Seems to satisfy my immediate requirements.

If I have problems I'll download the French version on my ADN account and see the issue first hand.

Thanks to all for the responses.

Regards,
Kerry
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Patrick_35

  • Guest
Re: External Reference PathType
« Reply #12 on: December 16, 2014, 04:23:37 AM »
You can also set yourself on relative path and use it in the _path's option
It's in this way that works lisp I posted above

@+

lamarn

  • Swamp Rat
  • Posts: 636
Re: External Reference PathType
« Reply #13 on: January 08, 2015, 04:45:19 PM »
Great tool Patrick_35 !
Thanks for sharing that lsp
 
I was using the one beneath for some time but
your repath routine also gets into unloaded dwg files..!
(save me a lot of loading time !!)

----

;;  XRP2004.lsp         by Mark McDonough
;;  V3.2                   Oct.15, 1999
;;  Updated as XRP2004.lsp by Mark McDonough, 4/20/04


;;  Rev.1 05/03/99 updated to work for renamed XREFs and for AK2
;;  Rev.2 10/10/99 updated to work for Image paths
;;  Rev 3 04/20/04 updated to remove restrictions on long filenames
;;  Rev 4 12/14/06 updated to allow loading in running in AutoCAD 2007 (although it's not been tested in 2007)
Design is something you should do with both hands. My 2d hand , my 3d hand ..

lamarn

  • Swamp Rat
  • Posts: 636
Re: External Reference PathType
« Reply #14 on: January 12, 2015, 03:34:45 AM »
Patrick
In order to make unloaded references relative i would like to set var. DWGPREFIX as a support path (like)  'project files search path'.
How can this be done?
Design is something you should do with both hands. My 2d hand , my 3d hand ..