乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 84|回复: 3

[综合讨论] Check from which directory a *

[复制链接]

2

主题

3

帖子

1

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-7 00:18:20 | 显示全部楼层 |阅读模式
Dear all,
 
To automatically switch profiles at startup I want to create a script that "looks" from which directory a *.DWG drawing is opened from. This detection script runs directly when AutoCAD starts up.
 
If the user opens a drawing from c:\tek\ then "profile_one" has to be selected, and if the user opens a drawing from every other directory then "profile_two" must be selected.
 
Please can you help me to "detect" from which directory a drawing is opened.
 
Thanks in advance!!
 
With kind regards,
 
Atmoz
(from the Netherlands, so excuses my English)
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-7 00:49:14 | 显示全部楼层
(setq answer (getvar "dwgprefix"))
 
plus a "startup" lsp to change profile
回复

使用道具 举报

2

主题

3

帖子

1

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-7 01:03:20 | 显示全部楼层
Thanks for the reply!
 
In the meanwhile I've had it working with VBA...
 
MyDocument.FullName
 
if Mid$(GeopendDocument, 1, 7) = "C:\tek\" then... else... end if
 

 
With kind regards,
 
Atmoz
回复

使用道具 举报

44

主题

3166

帖子

2803

银币

中流砥柱

Rank: 25

铜币
557
发表于 2022-7-7 01:38:20 | 显示全部楼层
  1. (defun c:FOO (/ *profs* pNames profNameList myProfName) (vl-load-com)  (if (and        (setq *profs* (vla-get-profiles                      (vla-get-preferences (vlax-get-acad-object))))        (vla-getallprofilenames *profs* 'pNames)        (setq profNameList (vlax-safearray->list pNames))        (vl-string-search "C:\\TEK\" (strcase (getvar 'dwgprefix))))    (setq myProfName "[color=red]PROFILE_ONE[/color]")    (setq myProfName "[color=red]PROFILE_TWO[/color]")) (if (vl-position myProfName profNameList)   (progn     (vla-put-activeprofile *profs* myProfName)     (prompt (strcat "\n  >>  Profile "" myProfName "" Has Been made Active! ")))   (prompt (strcat "\n    Profile "" myProfName "" Cannot Be Found   "))) (princ))
 
::  Untested  ::
 
Hope this helps!
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-9 08:53 , Processed in 0.534878 second(s), 60 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表