Jump to content

c# - Transform absolute XREF links in relative


Recommended Posts

Posted

I try to do a very simple thing : transform the absolute XREF links in relative in C#.

 

I have no idea how can I translate the XREF path in relative.

 

I don't know where I can start.

 

I saw this article but does'nt help me ! Have you got information or details how can I do that?

 

Thanks a lot,

Posted

Stephen's DevBlog article has everything you need, with exception of the assumed drawing, and XREF locations (you'll have to do that per your project folder structure, etc.).

 

Cheers

Posted

Ok,

 

So, I will do my homework.

 

Thanks

Posted

Hi,

 

I see more the code.

 

Stephen DevBlog uses the case where you know the current path of your XREF and the current path of your files. I don't want to rely to FindFile to find my XREF, on very big project, it's impossible.

 

The fonction must deduce (that's the main point) what is the relative path.

 

Do you understand my horrible English?

 

Best regards

 

In my idea, I would like to have a generic case.

 

I launch the command, the script must knows where I am and how can I make a relative path to all my XREF.

 

The main problem is to find a solution to {oldpathabsolute} {newpathrelative} without external intervention.

Posted
Hi,

 

I see more the code.

 

Stephen DevBlog uses the case where you know the current path of your XREF and the current path of your files. I don't want to rely to FindFile to find my XREF, on very big project, it's impossible.

 

The fonction must deduce (that's the main point) what is the relative path.

 

Do you understand my horrible English?

 

Best regards

 

In my idea, I would like to have a generic case.

 

I launch the command, the script must knows where I am and how can I make a relative path to all my XREF.

 

The main problem is to find a solution to {oldpathabsolute} {newpathrelative} without external intervention.

 

Consider using System.IO to 'find' the relative path, by removing the folders common to both the drawing you're evaluating via side-Database, and your BlockTableRecord's PathName, concatenating the resultant string as needed (i.e., "..\" + "SomePath").

 

Cheers

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