×
热门分类
微信扫码登陆

QQ登录

只需一步,快速开始

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即加入SketchUp吧! 微信扫码登陆

x
SU在超BIM方向前进的道路上困难重重:首先是出的报告到EXCEL里中文乱码;跟着是在DC里设置的各类信息全都导出到EXCEL里了,有时直接导致列内数据错位,DC里面附加信息有选择的导出到EXCEL是比较理想的状况,可惜估计同中文乱码一样,一时得不到根本性的解决;现在只能退而求其次:DC里面只含需要计算数量的数据,能把需要的统计数据导出到EXCEL就OK,其它的属性添加全在另一个插件里完成:
ATTRIBUTE  MANAGER,这个插件也是比较好的,现在需要汉化及对插件瘦身,希望能得到坛子里的高人协助

精彩评论

文明上网理性发言、请文明用语

169

主题

2314

帖子

2952

红宝石

网站创始人

Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29

红宝石
2952

SuBAR聚会纪念邮 成都站SuBAR_CLT汉化团队宝石收藏家核心会员共享精神奖财富大亨忠实粉丝热心助人奖社区微博达人

QQ
双鱼 2009-4-9 22:28:00
ATTRIBUTE  MANAGER这个插件本身不是很大:53.1KB。
周末如果有精力就把它汉化一下吧。
其实这类未加密rb文件汉化没有难度,打开后修改相关字串就行;要的只是耐心,测试双字节的偏移。大家可以自己试着来汉化的。

这个插件不知有没有出新版本。

36

主题

289

帖子

250

红宝石

SU有道(等级7)

Rank: 7Rank: 7Rank: 7

红宝石
250

优秀创意奖优秀技术奖荣誉会员社区微博达人

zfBIM 2009-4-9 22:41:00
感谢双鱼大大的鼎力相助,从SCF上看这个插件没有更新的版本,如图是这插件的几个界面:
001是第一界面,有两个出口002和004,003是002的次级界面,现在希望去掉001及004,直接进入002及其次级界面,需要保障输入的汉字能保持,不乱码。
再次感谢双鱼及热心的朋友!

jpg

jpg

jpg

jpg

jpg

jpg

jpg

jpg

421

主题

4465

帖子

1658

红宝石

论坛元老

企鹅组长

Rank: 16Rank: 16Rank: 16Rank: 16

红宝石
1658

核心会员宝石收藏家热心助人奖忠实粉丝优秀创意奖荣誉会员Sketchup建模大赛 第五期 TOP5

QQ
刘企 2009-4-10 12:31:00
这是个什么插件啊?

36

主题

289

帖子

250

红宝石

SU有道(等级7)

Rank: 7Rank: 7Rank: 7

红宝石
250

优秀创意奖优秀技术奖荣誉会员社区微博达人

zfBIM 2009-4-10 18:25:00

贴上源代码,请双鱼,ODM,麦兜和富农这些RB高手帮我们讲解一下插件的汉化方法!也算授人以渔吧!

:Z # Copyright (c) 2007 Google Inc.
require 'sketchup.rb'
class DataInitializer
    def initialize(use_def_if_available)
        #Sketchup.active_model.start_operation("Attribute Edits");
        ss = Sketchup.active_model.selection
        if(ss.empty? || ss.count != 1)
            $entity = Sketchup.active_model;
        else
            $entity = ss[0];
            if($entity.class == Sketchup::ComponentInstance)
                if(use_def_if_available)
                    $entity = $entity.definition
                elsif(IDYES == UI::messagebox("Use Definition?", MB_YESNO))
                    $entity = $entity.definition
                end
            end
        end
        initStandardTabs();
    end
def initTextAttrib(dict,name)
  $entity.set_attribute(dict,name,dict+":"+name) if(nil == $entity.get_attribute(dict,name))
end
   
    def initLinkAttrib(dict,name,url)
  $entity.set_attribute(dict,name,url) if(nil == $entity.get_attribute(dict,name))
end
   
def initAuthorTab()
  initTextAttrib("AuthorInfo","name");
  initLinkAttrib("AuthorInfo","email", "[email=//someone@somewhere.com]mailto://someone@somewhere.com[/email]");
        initLinkAttrib("AuthorInfo","link", "http://sketchup.google.com");
end
   
def initProductTab()
  initTextAttrib("ProductInfo","brand");
  initTextAttrib("ProductInfo","brand_link");
  initTextAttrib("ProductInfo","link");
  initTextAttrib("ProductInfo","image_link");
  initTextAttrib("ProductInfo","id");
  initTextAttrib("ProductInfo","product_type");
  initTextAttrib("ProductInfo","specification_code");
  initTextAttrib("ProductInfo","specification_standard");
    end
def initModelTab()
  initTextAttrib("ModelInfo","title");
  initTextAttrib("ModelInfo","description");
  initTextAttrib("ModelInfo","tags");
  initLinkAttrib("ModelInfo","link","http://sketchup.google.com/3dwarehouse");
  initTextAttrib("ModelInfo","warehouse_id");
  initTextAttrib("ModelInfo","last_modified");
end

   
def initStandardTabs()
  initAuthorTab();
        initModelTab();
        initProductTab();
end
end
class AttribManagerBase
def initialize(use_def_if_available)
        @modified = false;
        Sketchup.active_model.start_operation("Attribute Edits");
        ss = Sketchup.active_model.selection
        if(ss.empty? || ss.count != 1)
            $entity = Sketchup.active_model;
        else
            $entity = ss[0];
            if($entity.class == Sketchup::ComponentInstance)
                if(use_def_if_available)
                    $entity = $entity.definition
                elsif(IDYES == UI::messagebox("Use Definition?", MB_YESNO))
                    $entity = $entity.definition
                end
            end
        end
        cleanser = AttributeCleanser.new($entity);
        cleanser.clean();
        
        closed = false;
  $dlg = UI::WebDialog.new("Attribute Manager", true, "AM");
  $dlg.set_file(File.dirname(__FILE__) + "/AttribEditor.html");
  $dlg.add_action_callback("on_cancel") {|d,p| closed=true;Sketchup.active_model.abort_operation(); $dlg.close() }
  $dlg.add_action_callback("on_accept") {|d,p| closed=true;Sketchup.active_model.commit_operation(); $dlg.close() }
  $dlg.add_action_callback("on_close") {|d,p| $dlg.close() }
  $dlg.add_action_callback("on_delete_attribute") {|d,p| deleteAttribute(d, p); }
  $dlg.add_action_callback("on_edit_attribute") {|d,p| editAttribute(d, p); }
  $dlg.add_action_callback("on_add_attribute") {|d,p| addAttribute(d, p); }
  $dlg.add_action_callback("on_delete_dictionary") {|d,p| deleteDictionary(d, p); }
  $dlg.add_action_callback("on_add_dictionary") {|d,p| addDictionary(d, p); }
  $dlg.add_action_callback("create_standard_categories") {|d,p| createStandardCategories(d, p); }
        
        $dlg.set_size 600, 400;
        $dlg.set_on_close {
            check_save() if(!closed)   
        }
        
        showDialog();
    end
    def check_save()
        if(@modified)
            save = UI::messagebox("Save changes?", MB_YESNO);
            if(save==IDNO)
                Sketchup.active_model.abort_operation();
            else
                Sketchup.active_model.commit_operation();
            end
        else
            Sketchup.active_model.abort_operation();
        end
    end
   
    def createStandardCategories(d,p)
        @modified = true;
        DataInitializer.new($entity);
        json = getJSONDictionaries();
        $dlg.execute_script("initJson('" + json + "', true)");
    end
   
    def fromJSON(str)
        null=nil;
        eval(str.gsub(/(["'])\s*:\s*(['"0-9tfn\[{])/){"#{$1}=>#{$2}"})
    end
   

    def deleteAttribute(d, p)
        @modified = true;
        # extract the dict and name from the parameters
        dict_and_name = fromJSON(p);
        dict = $entity.attribute_dictionaries[dict_and_name["dict_name"]];
        if(dict != nil)
            dict.delete_key dict_and_name["attrib_name"];
        end
    end
   
    def editAttribute(d, p)
        @modified = true;
        params = fromJSON(p);
        dict = $entity.attribute_dictionaries[params["dict_name"]];
        if(dict != nil)
            # delete the existing attribute
            dict.delete_key params["attrib_name"];
            # add it with the new name/value
            dict[ params["attrib_name"] ] = params["attrib_value"];
        end
    end
   
    def addAttribute(d, p)
        @modified = true;
        params = fromJSON(p);
        dict = $entity.attribute_dictionaries[params["dict_name"]];
        if(dict != nil)
            # add it with the new name/value
            dict[ params["attrib_name"] ] = params["attrib_value"];
        end   
    end
   
    def deleteDictionary(d, p)
        @modified = true;
        $entity.attribute_dictionaries.delete p;
    end
    def addDictionary(d, p)
        @modified = true;
        $entity.attribute_dictionary p, true;
    end
    # escapges the characters in the given string so that the
    # resulting string can be used as an argument to a javascript
    # function.
    def escapeChars(s)
        s.gsub('"','\\\\\\"').gsub("'","[url=]\\\\'[/url]");
    end
   
    def getJSONDictionaries()
        json = '{"dictionaries":[';
        dicts = $entity.attribute_dictionaries
        if(dicts != nil)
            dicts.each do |dict|
                json += '{"name":"' + dict.name + '","attributes":[';
               
                dict.each_key do |attribName|
                    json += '{';
                    json += '"name":"' + attribName + '",';
                    if(dict[attribName].class != Geom::Transformation)
                        json += '"value":"' + escapeChars(dict[attribName].to_s) + '"},';
                    else
                        json += '"value":"' + escapeChars(dict[attribName].to_a.to_s) + '"},';
                    end
                end
                json += ']},'
            end
        end
        json += "]}";
        json.gsub!(/,/,"#COMMA#");
        return json;
    end
   
    def showDialog()
  $dlg.show_modal() {
            json = getJSONDictionaries();
            $dlg.execute_script("initJson('" + json + "')");
  }
    end
   
end
class AttribManagerAll < AttribManagerBase
   def initialize()
        super(false)
    end
    end
class AttribManagerProduct < AttribManagerBase
   def initialize()
        super(true)
    end
end
class AttributeCleanser
    def initialize(ent)
        $ent = ent
    end
   
    def clean()
        dicts = []
        toDelete = []
        dictNames = []
        ads = $ent.attribute_dictionaries;
        return if ads == nil;
        i = 0
        ads.each do |d|
            if(dictNames.index(d.name) == nil)
                dicts.push(d)
                dictNames.push(d.name)
            else
                toDelete.push(d)
            end
            i = i + 1
        end
        
        toDelete.each do |d|
            ads.delete d
        end
    end
end
$helpHTML=<<EOHELP   
    <html>
    <body>
    <b>Help for Attribute Manager functions.</b>
    <p>
    This plugin helps you manage the attributes found on the model and
    entities contained within the model.  
    <p>
    It is accessed in two ways:
    <ol>
      <li>Via the main menus: <span style="font-family:courier">Tools > Attributes</span>
      The options here apply to the entire model.
      <li>Via context (right click) menus: <span style="font-family:courier">Attributes</span>
      The options here apply to the <em>single</em> selected item.
    </ol>
    <p>
    There are 3 operations possible from the menus -
    show the attributes, cleanse the attributes of duplicate categories, and
    make the standard categories.
    <p>
    The <b>Show</b> option will launch a modal dialog that allows you to create and delete
    attribute categories and add/edit/delete individual attributes.
    <p>
    If an attribute value starts with "http://" or "[email=//]mailto://[/email]" then the value will be displayed
    without the prefix, but with the link automatically created.
    </body>
    </html>
EOHELP
subMenu = UI::menu("Tools").add_submenu("Attributes");
subMenu.add_item("Show") {
AttribManagerAll.new
}
subMenu.add_item("Make standard categories") {
DataInitializer.new(true)
}
subMenu.add_item("Remove duplicates") {
    # make sure there is only one of each dictionary of a given name
    ac = AttributeCleanser.new(Sketchup.active_model);
    ac.clean();
}
   
subMenu.add_separator
subMenu.add_item("Help") {
dlg = UI::WebDialog.new("Attribute Manager Help", true, "AMHelp")
    dlg.set_html($helpHTML)
    dlg.show
}
   
   
UI::add_context_menu_handler do |menu|
    if(Sketchup.active_model.selection.count == 1)
        menu.add_separator
        subMenu = menu.add_submenu("Attributes");
        
  subMenu.add_item("Show") {
            AttribManagerProduct.new;
        }
        
        subMenu.add_item("Make standard categories") {
            DataInitializer.new(true)
        }
        subMenu.add_item("Remove duplicates") {
            AttributeCleanser.new(Sketchup.active_model.selection.first);
        }        
    end
end

2

主题

98

帖子

0

红宝石

SU入学(等级1)

Rank: 1

红宝石
0
xuyago 2009-4-10 18:33:00

回复 2# 双鱼 的帖子

请问rb都是java编写的吗?rb差价的语言包是在哪个文件里的?谢谢。

2

主题

98

帖子

0

红宝石

SU入学(等级1)

Rank: 1

红宝石
0
xuyago 2009-4-10 18:37:00
我觉得源代码中都是要执行的语句,不能汉化,汉化的话需要外挂的语言包。我的观点,我不懂ruby,不动java

36

主题

289

帖子

250

红宝石

SU有道(等级7)

Rank: 7Rank: 7Rank: 7

红宝石
250

优秀创意奖优秀技术奖荣誉会员社区微博达人

zfBIM 2009-4-10 18:39:00
如果这个插件能得到合理的瘦身及汉化,期望它就是未来信息模型的信息母体,也是SU实现BIM的基本信息库文件基础。

314

主题

1880

帖子

2865

红宝石

网站创始人

老到陈腐

Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29

红宝石
2865

2012龙年春节团拜纪念邮SuBAR_CLT汉化团队宝石收藏家核心会员财富大亨热心助人奖

diweiman 2009-4-11 03:29:00
我在su7中生成报表,html格式没有乱码,csv格式会乱码,不过可以先导出html格式然后用excel直接打开html文件就可以解决乱码的问题吧
表格错位没有见到
没有选择性导出
su7组件属性的属性名不能是字母和数字外的其他字符也是个缺陷,不过可以忍受
一个板凳的试验:su7版本
板凳.rar (7.89 KB, 下载次数: 13)

生成的报表,长宽高不知道以什么为单位的,反正不是公制,在组件属性里添加lenX,Y,Z这几个属性并定义单位也没用,晕菜.....

png

png




另:插件汉化的时候,不必劳神去调整双字节单字节的,只要把rb文件打开,先转成UTF-8编码,然后编辑汉化,保存就可以了。找一个能够方便转换文本编码的文本编辑器就可以了,我用Emeditor。我汉化插件都用这个方法,没出现过乱码情况,请各位参考。
至于汉化方法,其实我是一点都不懂Ruby的,我汉化rb文件都是认真看看,凭自己对其他语言语法的一些了解,判断哪些地方是纯粹的显示文本,一般就是双引号里的文字,但双引号里的不一定都是能修改的地方,有些是属性名或函数方法名,改了就运行不了了,一般如messagebox后面的就是能改的,是弹出对话框的显示文本,还有类似add_menu字样后的相关文本是增加菜单项的,可以汉化。。。。。多少还是需要一些时间,去熟悉ruby的基本语法规则。

赞赏

1

查看全部评分

314

主题

1880

帖子

2865

红宝石

网站创始人

老到陈腐

Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29

红宝石
2865

2012龙年春节团拜纪念邮SuBAR_CLT汉化团队宝石收藏家核心会员财富大亨热心助人奖

diweiman 2009-4-11 03:54:00
zfBIM说的那个插件不只这一个文件吧,主要内容是一些html和js文件,汉化工作主要在那些文件上面。

36

主题

289

帖子

250

红宝石

SU有道(等级7)

Rank: 7Rank: 7Rank: 7

红宝石
250

优秀创意奖优秀技术奖荣誉会员社区微博达人

zfBIM 2009-4-11 10:32:00
是,这里面共有11个文件;


并附上此插件:

jpg

jpg

Attribs.rar

21.25 KB, 下载次数: 43, 下载积分: 吧币 -200 个

rar

36

主题

289

帖子

250

红宝石

SU有道(等级7)

Rank: 7Rank: 7Rank: 7

红宝石
250

优秀创意奖优秀技术奖荣誉会员社区微博达人

zfBIM 2009-4-11 11:16:00
无私的富农,请接受我诚挚的敬意与感谢!
HTML格式完美解决了汉字乱码的问题,你的这一发现为SU朝BIM迈进铲除了一颗巨大的顽石,相对而言其它的一些问题已显得微乎其微了。

感谢富农!再次感谢!

314

主题

1880

帖子

2865

红宝石

网站创始人

老到陈腐

Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29Rank: 29

红宝石
2865

2012龙年春节团拜纪念邮SuBAR_CLT汉化团队宝石收藏家核心会员财富大亨热心助人奖

diweiman 2009-4-11 13:26:00
原帖由 zfBIM 于 2009-4-11 11:16:00 发表
无私的富农,请接受我诚挚的敬意与感谢!
HTML格式完美解决了汉字乱码的问题,你的这一发现为SU朝BIM迈进铲除了一颗巨大的顽石,相对而言其它的一些问题已显得微乎其微了。

感谢富农!再次感谢!

嘿嘿,不要搞个人崇拜哦~

0

主题

2

帖子

0

红宝石

SU入学(等级1)

Rank: 1

红宝石
0
lx_o 2009-10-5 13:56:37
非常不错

0

主题

50

帖子

1

红宝石

SU入学(等级1)

Rank: 1

红宝石
1
bcbman 2010-1-31 15:52:36
verycd上有关于ruby的资料,有需要的话,可以搜一搜

5

主题

19

帖子

11

红宝石

SU游学(等级2)

Rank: 2

红宝石
11
leimikk 2013-5-25 21:22:16
感谢zfBIM 的分享,非常有帮助,这个插件的值得好好学习!!!

4

主题

2468

帖子

15

红宝石

SU游学(等级2)

Rank: 2

红宝石
15

忠实粉丝社区微博达人积极讨论奖

dai025dai 2014-7-12 02:29:05
在翻DBO资料看到ATTRIBUTE  MANAGER的汉化信息  竟然是2009年的事情了  时隔5年   不知道这个插件有没有蜕变~   单貌似SU本身已经成为了一个正真的“草图大师” 在诸多的设计工作中扮演着出创意和草稿的工作。

13

主题

278

帖子

97

红宝石

SU学师(等级6)

Rank: 6Rank: 6

红宝石
97
╄→紫色望海℡ 2015-6-16 17:19:21
学习和了解一下

0

主题

5

帖子

0

红宝石

红宝石用户A

Rank: 22Rank: 22Rank: 22Rank: 22Rank: 22Rank: 22

红宝石
0
18766174181 2015-8-20 13:59:55
装一个试试

0

主题

2

帖子

0

红宝石

SU入学(等级1)

Rank: 1

红宝石
0
huoyue0094 2018-3-27 15:32:15
不是太好用,有些属性显示不了
高级模式
您需要登录后才可以回帖 登录 | 立即加入SketchUp吧! 微信扫码登陆

本版积分规则

zfBIM

SU有道(等级7)

  • 主题

    36

  • 吧币

    0

  • 红宝石

    250

关闭

站长推荐上一条 /2 下一条

积分兑换活动
发布主题 快速回复 返回列表 客服中心 搜索 官方QQ群
关于我们/小黑屋/手机app/国土人/SketchUp吧 /京ICP备16008035号/