Jump to content

Recommended Posts

Posted
The brackets are unbalanced like me type too. quick

 

(Strcat "\" "deg" "\" )

 

 

BigAl, what does that mean?

  • 3 weeks later...
  • Replies 24
  • Created
  • Last Reply

Top Posters In This Topic

  • broncos15

    13

  • hmsilva

    9

  • BIGAL

    2

  • ROBP

    1

Posted
Hi broncos15,

perhaps something like this

(vl-load-com)
(defun c:demo (/ blk path sel)
   (if
       (and
           (setq sel (entsel "\nSelect a Xref: "))
           (setq blk (vlax-ename->vla-object (car sel)))
           (vlax-property-available-p blk 'Path)
           (setq path (vla-get-path blk))
       )
          (vla-activate
           (vla-open (vla-get-documents (vlax-get-acad-object)) (strcat "\"" path "\"") :vlax-true)
       )
   )
   (princ)
)

Hope this helps,

Henrique

Henrique, I am trying to make a slight modification to your code. My issue is when I am trying to open an xref with a relative path. My solution seems like it is much more complicated than it needs to be. It involves using the -xref command and making the path absolute for the selected xref, then making it relative after the open read only has occurred.
(command-s "._xref" "_t" blk "_F")

Then after the vla-open portion doing:

(command-s "._xref" "_t" blk "_R")

Is there an easier solution?

Posted

Hi broncos15,

I dont have AutoCAD is this laptop, but try to add

(and
  (setq sel (entsel "\nSelect a Xref: "))
  (setq blk (vlax-ename->vla-object (car sel)))
  (vlax-property-available-p blk 'Path)
  (setq path (vla-get-path blk))
  (setq path (findfile path));<<<<<<
)

 

Henrique

Posted
Hi broncos15,

I dont have AutoCAD is this laptop, but try to add

(and
  (setq sel (entsel "\nSelect a Xref: "))
  (setq blk (vlax-ename->vla-object (car sel)))
  (vlax-property-available-p blk 'Path)
  (setq path (vla-get-path blk))
  (setq path (findfile path));<<<<<<
)

 

Henrique

Henrique, thank you so much for your help! Your way is much more efficient than mine. It will be useful to know this for future codes as well, so thanks for the help!
Posted

You're welcome, broncos15

Glad I could help

 

Henrique

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