Jump to content

Selct a Path to preview drawing


au-s

Recommended Posts

Hi guys,

 

Got a little problem.

I have a file, lets call it 1.dwg saved in c:\\one\\two\\three\\four

I have another file I want to preview and insert to my 1.dwg in c:\\one\\two\\here\\Iam

 

Now I do this to get absolutepath to the drawing:

[font=Arial][font=Arial](setq absolutepath (strcat (getvar "DWGPREFIX") )) [/font]
[/font]

Then to get the path to the other drawin I want to insert I do:

[font=Arial][font=Arial][font=Arial](setq path1 (dos_absolutepath absolutepath "..\\..\\here\\Iam"))[/font]
[/font][/font]

That gives me c:\\one\\two\\here\\Iam, exactly what I want.

I preview that then with:

(setq file (dos_dwgpreview "Choose File:" path1 ".dwg"))

BUT, the problem is that I need to open the drawing first from the right path "c:\\one\\two\\three\\four for that to take effect.

If I, say open it in another path, like c:\\get\\this\\right\\here and save as in c:\\one\\two\\three\four that doesn't work and will point to c:\\get\\this\\here\\Iam.

 

So, I have to open it in the right path to get the lisp to work its way to the right folder.

Now, that isn't really a problem but it's irritating. You can always warn a user to save as in the right path and then reopen it.

 

And without any experiance I say that "I don't think that substr works here". :) That because of folder-structures and paths, see below.

c:\\project1\\one\\two\\three\\four

c:\\project2\\one\\two\\three\\four

 

Of course, that requires DOSlib for the dos_absolutepath to work. And I do have that, allthough maybe there's another way but I do find DOSlib helpfull sometimes.

 

Link to comment
Share on other sites

Okay,

 

I was wrong about substr. I used substr.

Allthough the same problem. You have to open it from the right location to trigger the lisp

Link to comment
Share on other sites

it seems to work so far when I do:

(setq absolutepath (strcat (getvar "DWGPREFIX"))
path1 (substr absolutepath 1 32)
stamppath (strcat path1 "here\\Iam")
)

 

All in one setq that is

Link to comment
Share on other sites

I haven't read the whole thread as yet, but FYI:

 

(setq absolutepath (strcat (getvar "DWGPREFIX"))

You aren't concatenating strings so you don't need the strcat.

 

(setq absolutepath (getvar "DWGPREFIX")

 

It won't affect whether it works or not though.

Link to comment
Share on other sites

Yeah, the lisp is working perfectly but I need to OPEN the drawing from the right location first.

I can't ie open a template.dwt and then save as in right location and run the lisp. It won't work. it will then try to make the path1 from the template location.

BUT when I open it from the right location then it somehow knows how to behave ;)

Edited by au-s
Link to comment
Share on other sites

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