乐筑天下

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

[编程交流] Inserting dynamic block - sett

[复制链接]

4

主题

10

帖子

6

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-5 16:24:09 | 显示全部楼层 |阅读模式
Hello everyone!
 
I've been trying to figure this out, but I'm stuck on an error I keep getting.  I've been using code found here in this forum, but what was working for other doesn't seem to work for me.
 
I can insert the block, but after that, I get an error and the code seems to die and doesn't set the parameter I want.
 
Here's the code so far:
  1. (defun C:tblk() (vl-load-com) (setq oattreq (getvar 'attreq)) (setvar 'attreq 0) (command "_insert" "DYN_GRID" "S" "1" "R" "0" PAUSE) (setvar 'attreq oattreq) (LM:setdynpropvalue ( (vlax-ename->vla-object entlast) "X_25mark" "100")));; Set Dynamic Block Property Value  -  Lee Mac;; Modifies the value of a Dynamic Block property (if present);; blk - [vla] VLA Dynamic Block Reference object;; prp - [str] Dynamic Block property name (case-insensitive);; val - [any] New value for property;; Returns: [any] New value if successful, else nil(defun LM:setdynpropvalue ( blk prp val )   (setq prp (strcase prp))   (vl-some      '(lambda ( x )           (if (= prp (strcase (vla-get-propertyname x)))               (progn                   (vla-put-value x (vlax-make-variant val (vlax-variant-type (vla-get-value x))))                   (cond (val) (t))               )           )       )       (vlax-invoke blk 'getdynamicblockproperties)   ))
 
The error I'm getting is:
 
Now, as best as I can trouble shoot it, the error is being caused here:
  1. (LM:setdynpropvalue ( (vlax-ename->vla-object entlast) "X_25mark" "100"))
 
However, I've tried every permutation of writing that to get it to run, but it won't.
 
The goal of this is to be able to allow users to insert a dynamic block and at the same time set the X and Y of the grid (which is an X/Y array).
 
I thought this would be simple enough.  The parameter "X_25mark" is the X direction, and for now I'm trying to hard code it at "100".  However, in the future, I would like to ask the user to enter what X and Y they want for the grid.
 
Can anyone help get me back on track?
 
Thank you in advance!
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 17:31:28 | 显示全部楼层
  1. (LM:setdynpropvalue (vlax-ename->vla-object (entlast)) "X_25mark" "100")
Assumes that your "X_25mark" dynamic block parameter requires a string value.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-14 13:09 , Processed in 0.556645 second(s), 67 queries .

© 2020-2025 乐筑天下

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