Jump to content

Recommended Posts

Posted

Hello

 

I'm trying use Vault commands in my lisp routine, specifically the "-vltattach".

But I'm running into an issue that I don't quite know how to fix.
Here's the relevant snippet of code from my routine:

 

(setq ip (list 0 0 0))
(command "-vltattach" fullpad "_no" ip 1 "" 0)

 

"Fullpad" is a variable that has the filepath stored in it and "ip" is a variable with the insertion point.

The command can find and load the file from the Vault fine, but then it seems to not want to accept any input for the insertion point.
Does anyone have an idea as to what the problem could be and how to fix it?

 

Posted

It is not a command I use, does it report any error messages?

Are you able to post an example Fullpad string - what the file path looks like?

Posted (edited)

this command is a first for me too , but , probably like Steven P , I suspect your path is the problem , make sure you use either use / or \\ in your path

 

you could try (if (setq fullpath (findfile fullpath))(command....

 

or if fullpath is a folder use vl-file-directory-p to at least have some basic checking.

Edited by rlx
Posted

Just another comment if the file name has spaces in it need to use \\.

Posted

The full path looks like this:
 

$/Designs/I-I.NO.06_A_E/cab/0_GRB/xyz.dwg

 

With the name of the DWG changing depending on which one needs to be attached.

This is what the command line looks like:
image.thumb.png.36934ee7cd6c81a41c59fcb31438cfb4.png

 

To me that looks like it can find the file just fine, but after it finds the file it goes into the -xref command. But I've got no clue as to why it does that.

This is my full code in case that helps.
I've used part of Lee Mac's List Box routine to have the user select the name of the DWG file they want.

 

(defun C:GRBX (/ msg lst bit dch des tmp gemeentenaam pad oldfiledia oldinsunits fullpad ip)
  ;FILEDIA is een systeemvariable die instaat voor dialoogvensters bij het navigeren naar files. Wordt op 0 gezet zodat "DXFIN" en "SAVEAS" geen dialoogvenster weergeven en via de commandline werken
  (setq oldfiledia (getvar "FILEDIA"))
  (setq oldinsunits (getvar "INSUNITS"))
  (setvar "FILEDIA" 0)
  (setvar "INSUNITS" 0)
  (setq ip (list 0 0 0))
  ;variabele die de titel van het dialoogvenster bepaalt
  (setq msg "Kies een gemeente")
  ;variabele met een lijst van alle gemeentes in Vlaanderen
  (setq lst '("AALST" "AALTER" "AARSCHOT" "AARTSELAAR" "AFFLIGEM" "ALKEN" "ALVERINGEM" "ANTWERPEN" "ANZEGEM" "ARDOOIE" "ARENDONK" "AS" "ASSE" "ASSENEDE" "AVELGEM" "BAARLE-HERTOG" "BALEN" "BEERNEM" "BEERSE" "BEERSEL" "BEGIJNENDIJK" "BEKKEVOORT" "BERINGEN" "BERLAAR" "BERLARE" "BERTEM" "BEVER" "BEVEREN" "BIERBEEK" "BILZEN" "BLANKENBERGE" "BOCHOLT" "BOECHOUT" "BONHEIDEN" "BOOM" "BOORTMEERBEEK" "BORGLOON" "BORNEM" "BORSBEEK" "BOUTERSEM" "BRAKEL" "BRASSCHAAT" "BRECHT" "BREDENE" "BREE" "BRUGGE" "BUGGENHOUT" "DAMME" "DE_HAAN" "DE_PANNE" "DE_PINTE" "DEERLIJK" "DEINZE" "DENDERLEEUW" "DENDERMONDE" "DENTERGEM" "DESSEL" "DESTELBERGEN" "DIEPENBEEK" "DIEST" "DIKSMUIDE" "DILBEEK" "DILSEN-STOKKEM" "DROGENBOS" "DUFFEL" "EDEGEM" "EEKLO" "ERPE-MERE" "ESSEN" "EVERGEM" "GALMAARDEN" "GAVERE" "GEEL" "GEETBETS" "GENK" "GENT" "GERAARDSBERGEN" "GINGELOM" "GISTEL" "GLABBEEK" "GOOIK" "GRIMBERGEN" "GROBBENDONK" "HAACHT" "HAALTERT" "HALEN" "HALLE" "HAM" "HAMME" "HAMONT-ACHEL" "HARELBEKE" "HASSELT" "HECHTEL-EKSEL" "HEERS" "HEIST-OP-DEN-BERG" "HEMIKSEM" "HERENT" "HERENTALS" "HERENTHOUT" "HERK-DE-STAD" "HERNE" "HERSELT" "HERSTAPPE" "HERZELE" "HEUSDEN-ZOLDER" "HEUVELLAND" "HOEGAARDEN" "HOEILAART" "HOESELT" "HOLSBEEK" "HOOGLEDE" "HOOGSTRATEN" "HOREBEKE" "HOUTHALEN-HELCHTEREN" "HOUTHULST" "HOVE" "HULDENBERG" "HULSHOUT" "ICHTEGEM" "IEPER" "INGELMUNSTER" "IZEGEM" "JABBEKE" "KALMTHOUT" "KAMPENHOUT" "KAPELLEN" "KAPELLE-OP-DEN-BOS" "KAPRIJKE" "KASTERLEE" "KEERBERGEN" "KINROOI" "KLUISBERGEN" "KNOKKE-HEIST" "KOEKELARE" "KOKSIJDE" "KONTICH" "KORTEMARK" "KORTENAKEN" "KORTENBERG" "KORTESSEM" "KORTRIJK" "KRAAINEM" "KRUIBEKE" "KRUISEM" "KUURNE" "LAAKDAL" "LAARNE" "LANAKEN" "LANDEN" "LANGEMARK-POELKAPELLE" "LEBBEKE" "LEDE" "LEDEGEM" "LENDELEDE" "LENNIK" "LEOPOLDSBURG" "LEUVEN" "LICHTERVELDE" "LIEDEKERKE" "LIER" "LIERDE" "LIEVEGEM" "LILLE" "LINKEBEEK" "LINT" "LINTER" "LOCHRISTI" "LOKEREN" "LOMMEL" "LONDERZEEL" "LO-RENINGE" "LUBBEEK" "LUMMEN" "MAARKEDAL" "MAASEIK" "MAASMECHELEN" "MACHELEN" "MALDEGEM" "MALLE" "MECHELEN" "MEERHOUT" "MEISE" "MELLE" "MENEN" "MERCHTEM" "MERELBEKE" "MERKSPLAS" "MESEN" "MEULEBEKE" "MIDDELKERKE" "MOERBEKE" "MOL" "MOORSLEDE" "MORTSEL" "NAZARETH" "NIEL" "NIEUWERKERKEN" "NIEUWPOORT" "NIJLEN" "NINOVE" "OLEN" "OOSTENDE" "OOSTERZELE" "OOSTKAMP" "OOSTROZEBEKE" "OPWIJK" "OUDENAARDE" "OUDENBURG" "OUD-HEVERLEE" "OUDSBERGEN" "OUD-TURNHOUT" "OVERIJSE" "PEER" "PELT" "PEPINGEN" "PITTEM" "POPERINGE" "PUTTE" "PUURS-SINT-AMANDS" "RANST" "RAVELS" "RETIE" "RIEMST" "RIJKEVORSEL" "ROESELARE" "RONSE" "ROOSDAAL" "ROTSELAAR" "RUISELEDE" "RUMST" "SCHELLE" "SCHERPENHEUVEL-ZICHEM" "SCHILDE" "SCHOTEN" "SINT-GENESIUS-RODE" "SINT-GILLIS-WAAS" "SINT-KATELIJNE-WAVER" "SINT-LAUREINS" "SINT-LIEVENS-HOUTEM" "SINT-MARTENS-LATEM" "SINT-NIKLAAS" "SINT-PIETERS-LEEUW" "SINT-TRUIDEN" "SPIERE-HELKIJN" "STABROEK" "STADEN" "STEENOKKERZEEL" "STEKENE" "TEMSE" "TERNAT" "TERVUREN" "TESSENDERLO" "TIELT" "TIELT-WINGE" "TIENEN" "TONGEREN" "TORHOUT" "TREMELO" "TURNHOUT" "VEURNE" "VILVOORDE" "VLETEREN" "VOEREN" "VORSELAAR" "VOSSELAAR" "WAASMUNSTER" "WACHTEBEKE" "WAREGEM" "WELLEN" "WEMMEL" "WERVIK" "WESTERLO" "WETTEREN" "WEVELGEM" "WEZEMBEEK-OPPEM" "WICHELEN" "WIELSBEKE" "WIJNEGEM" "WILLEBROEK" "WINGENE" "WOMMELGEM" "WORTEGEM-PETEGEM" "WUUSTWEZEL" "ZANDHOVEN" "ZAVENTEM" "ZEDELGEM" "ZELE" "ZELZATE" "ZEMST" "ZOERSEL" "ZONHOVEN" "ZONNEBEKE" "ZOTTEGEM" "ZOUTLEEUW" "ZUIENKERKE" "ZULTE" "ZUTENDAAL" "ZWALM" "ZWEVEGEM" "ZWIJNDRECHT"))
  ;variable die bepaalt of meerdere gemeentes tegelijk geselecteerd kunnen worden
  ;0 = één enkele selectie tegelijk
  ;1 = meerdere selecties tegelijk
  (setq bit 0)
  ;variabele voor het pad naar de xref's in de vault
  (setq pad "$/Designs/I-I.NO.06_A_E/cab/0_GRB (read only gebruiken)/0_LISP_DWG")
  ;hier wordt het dialoogvenster gecreëerd. In plaats van een *.dcl te voorzien, wordt een tijdelijke file aangemaakt
  ;hierdoor blijft alles beperkt tot 1 lisp zonder extra files
  ;de tijdelijke file wordt verwijderd van zodra er op de "ok" knop gedrukt wordt
  (cond
        (   (not
                (and
                    (setq tmp (vl-filename-mktemp nil nil ".dcl"))
                    (setq des (open tmp "w"))
                    (write-line
                        (strcat "listbox:dialog{label=\"" msg "\";spacer;:list_box{key=\"list\";multiple_select="
                            (if (= 1 (logand 1 bit)) "true" "false") ";width=50;height=15;}spacer;ok_cancel;}"
                        )
                        des
                    )
                    (not (close des))
                    (< 0 (setq dch (load_dialog tmp)))
                    (new_dialog "listbox" dch)
                )
            )
            (prompt "\nError Loading List Box Dialog.")
        )
        (   t     
            (start_list "list")
            (foreach itm lst (add_list itm))
            (end_list)
            (setq gemeentenaam (set_tile "list" "0"))
            (action_tile "list" "(setq gemeentenaam $value)")
            (setq gemeentenaam
                (if (= 1 (start_dialog))
                    (if (= 2 (logand 2 bit))
                        (read (strcat "(" gemeentenaam ")"))
                        (mapcar '(lambda ( x ) (nth x lst)) (read (strcat "(" gemeentenaam ")")))
                    )
                )
            )
        )
  )
  (if (< 0 dch)
        (unload_dialog dch)
  )
  (if (and tmp (setq tmp (findfile tmp)))
        (vl-file-delete tmp)
  )
  ;als men een gemeente heeft gekozen wordt dit in de variabele "gemeentenaam" opgeslagen, maar als een lijst
  ;hier maken we van de lijst een gewone string zodat we deze gemakkelijk kunnen gebruiken in de rest van de functie
  (if gemeentenaam
    (progn
      (setq gemeentenaam (car gemeentenaam))
      ;(princ (strcat "Je koos '" gemeentenaam "'"))
    )
  )
  (setq fullpad (strcat pad "/" gemeentenaam ".dwg"))
  ;(princ fullpad)
  (command "-vltattach" fullpad "_no" ip 1 "" 0)
  (setvar "FILEDIA" oldfiledia)
  (setvar "INSUNITS" oldinsunits)
  (princ)
)

 

Posted (edited)

Small mistake in my previous post and since I can't find an edit button.
The full path is:

"$/Designs/I-I.NO.06_A_E/cab/0_GRB_(read_only_gebruiken)/0_LISP_DWG/xyz.dwg"


There's no more spaces in the file path or in the dwg names.
But the behavior of the command doesn't seem to have changed.

I've also noticed that the small part of code after the "-vltattach" command gets executed after the command accepts the "_no" input but before it jumps into the "xref" part I mentioned before.

Edited by YuriC
Posted

Not sure about the $ why is it not C : or D : or L : and so on.

Posted
13 hours ago, BIGAL said:

Not sure about the $ why is it not C : or D : or L : and so on.

 

That's how the paths look when you interact with files in the Vault (atleast at my workplace they do).

It changes to a drive letter when you download it from the Vault.

 

I was hoping to have the user not interact with Vault at all and have the lisp do the downloading for them, but I can't get it to work with "-vltattach"

So for now I've just implemented a work around in the shape of a pop up window telling the user to download the files themselves.
And then using the "-xref" command from there.
That works fine, but it's not as neat as I had wanted it.

Is anyone aware of other ways of downloading files from the Vault through autolisp?

Posted

Just dong some reading, Vault is an online file management system? I am guessing that the file location might not be a traditional 'c:' drive prefix, but more a 'www.' prefix for the file location.

 

Trying to work through this, does the command work if you manually enter it all - no variables and so on, something like

 

(command "-vltattach" "$/Designs/I-I.NO.06_A_E/cab/0_GRB_(read_only_gebruiken)/0_LISP_DWG/xyz.dwg" "_no" '(0 0 0) 1 "" 0)

 

and if you just run '-vltattach' just from the command line (no '(command.. in front of it) the details above work?

 

 

Posted
On 8/31/2024 at 11:55 PM, Steven P said:

Just dong some reading, Vault is an online file management system? I am guessing that the file location might not be a traditional 'c:' drive prefix, but more a 'www.' prefix for the file location.

 

Trying to work through this, does the command work if you manually enter it all - no variables and so on, something like

 

(command "-vltattach" "$/Designs/I-I.NO.06_A_E/cab/0_GRB_(read_only_gebruiken)/0_LISP_DWG/xyz.dwg" "_no" '(0 0 0) 1 "" 0)

 

and if you just run '-vltattach' just from the command line (no '(command.. in front of it) the details above work?

 

 

That is correct. Our company uses Vault to help with drawing version management between designers.
The file is somewhere on a server/cloud. The $ sign is what both AutoCAD and the Vault show as the drive letter when browsing through files.

I've tried using no variables at all for the command and it runs into the same problem.

If I run '-vltattach' from the command line. These are the things I have to enter (see image):
image.thumb.png.87aafcf2ad6df271cd341724ac764a07.png

 

The part I circled in red is something I don't do myself. AutoCAD does that on its own and after that I can enter the rest of the stuff.
I assume that's the reason it breaks in Autolisp?
-vltattach only needs the first 2 inputs and then it switches to -xref (in some way) for all the other inputs?

Posted

In the options what does 'pathtype' give you (instead of '_A')

Posted

Have you tried "_.-xref" instead of "_.-vltattach"...?

  • Like 1
Posted

Looking at the above -vltattach downloads the file locally but after that is done plain _.-xref might work?

Posted
4 hours ago, Steven P said:

In the options what does 'pathtype' give you (instead of '_A')

No idea. I don't type the '_A'. The command just chooses that.

After I've entered "_no" the next thing I can enter is the insertion point.
Everything between that is not done by me.

 

17 minutes ago, marko_ribar said:

Have you tried "_.-xref" instead of "_.-vltattach"...?

Yeah, but "-xref" can't download the file from the Vault for me, I believe.

If there's another way to get the file from the Vault through some form of automation and then -xref that's fine too.

 

1 minute ago, Steven P said:

Looking at the above -vltattach downloads the file locally but after that is done plain _.-xref might work?

That's what I was thinking, but I can't seem to figure out how to stop the -vltattach command after it's downloaded the file.
It just seems to transition into the -xref command by itself but that then seems to interfere with giving it the inputs for anything after that.

Posted

Maybe CAD don't recognize "_no" token as "_non" before point specification... I never used "_no"... I think that "_non" is equivalent to "_none" - both of those are good, but "_no" IMHO sounds to me like negation and not overriding current osnap settings...

Posted
14 hours ago, marko_ribar said:

Maybe CAD don't recognize "_no" token as "_non" before point specification... I never used "_no"... I think that "_non" is equivalent to "_none" - both of those are good, but "_no" IMHO sounds to me like negation and not overriding current osnap settings...

The "_no" is there because -vltattach asks "Download released biased related files [YES/NO]" after it asks for a file path. Since the files I'm working with don't have any related files to them it doesn't matter if they're "released biased" or "non-released biased" hence the "_no". I've tried "_n" (and even "_y" and "_yes") but that doesn't seem to make a difference.

Posted

maybe without the underscore 'no' - you'll have tried that all ready though I guess

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