AutoCAD Plant 3D General

Reply
Valued Contributor
kudryavcevrm
Posts: 85
Registered: ‎10-18-2007
Message 1 of 4 (376 Views)

When object has been insterted,next time script works incorrectly

376 Views, 3 Replies
06-21-2013 08:56 AM

Please, help me!

There's a simple script:

import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'CustomScripts'))



from aqa.math import *
from varmain.primitiv import *
from varmain.custom import *


@activate(Group="Support", TooltipShort="Test script", TooltipLong="This is a custom Testscript", LengthUnit="in")
@group("MainDimensions")
@param(aL=LENGTH, TooltipLong="Length of the Cylinder")


def TEST1(s, aL=75.0, ID='P_ACTUATOR_008', **kw):

       aL=float(raw_input("Input text"))
       print "You have been enter:"
       print (aL)

 Look here:

  1. Plant 3D Russian 2013 (Ultimate Suite) SP1, Windows 7 Ultimate
  2. I compile my script using PLANTREGISTERCUSTOMSCRIPT command and restart Plant 3D after this
  3. (arxload "PnP3dACPAdapter.arx")
  4. (TESTACPSCRIPT "TEST1")

Please see my command line log :

Команда: (arxload "PnP3dACPAdapter.arx")
"PnP3dACPAdapter.arx"

Команда: (TESTACPSCRIPT "TEST1")
Input text78
You have been enter:
78.0
<Имя объекта: 7ffff705c00>

Команда: (TESTACPSCRIPT "TEST1")
<Имя объекта: 7ffff705c20>

 

As you can see, my friends, when script was executed in the next time in the same session, it keeps aL value.

 

When we now execute _PURGE command, script will be executed correctly.

 

How to modify my script???

Valued Contributor
kudryavcevrm
Posts: 85
Registered: ‎10-18-2007
Message 2 of 4 (328 Views)

Re: When object has been insterted,next time script works incorrectly

06-27-2013 05:20 AM in reply to: kudryavcevrm

up

ADN Support Specialist
Marat.Mirgaleev
Posts: 37
Registered: ‎05-25-2011
Message 3 of 4 (292 Views)

Re: When object has been insterted,next time script works incorrectly

07-02-2013 01:36 AM in reply to: kudryavcevrm

The scripts are meant to create geometry (i.e. a block). To avoid regenerating the same block all the time, Plant 3D first looks up the block table if it already has a block that matches the script parameters. If such a block exists, it will just use it, and not invoke the script.

 

It looks like in this case, each block shall be unique. I haven’t tried it, but (TESTACPSCRIPT "…" "__unique__" "1") will probably do what is wanted. It will create an anonymous block instead of a block that hashes the parameters.



Marat Mirgaleev
Developer Technical Services
Autodesk Developer Network
Valued Contributor
kudryavcevrm
Posts: 85
Registered: ‎10-18-2007
Message 4 of 4 (233 Views)

Re: When object has been insterted,next time script works incorrectly

07-29-2013 06:00 AM in reply to: Marat.Mirgaleev
Thank you, Marat.
"__unique__" works fine in test mode. But we need to use script in real life, not in test mode only. We need to compile script as unique.
Help me, please!

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

New AutoCAD Plant 3D Category!

The AutoCAD Plant 3D forum has moved into it's very own category page, and can no longer be found within the Additional Product Forums.

Ask the Community